[Solved]Projection of Wire on Mesh

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
HakanSeven12
Veteran
Posts: 1481
Joined: Wed Feb 06, 2019 10:30 pm

Re: Projection of Wire on Mesh

Post by HakanSeven12 »

I will try it :)
User avatar
HakanSeven12
Veteran
Posts: 1481
Joined: Wed Feb 06, 2019 10:30 pm

Re: Projection of Wire on Mesh

Post by HakanSeven12 »

wmayer wrote: Wed Jun 26, 2019 3:46 pm With this I got for most of the wires a satisfactory solution
Yes most of it works but some of wire dont extend to edge. They stay last triangle edge.
bug.png
bug.png (161.29 KiB) Viewed 1073 times
User avatar
HakanSeven12
Veteran
Posts: 1481
Joined: Wed Feb 06, 2019 10:30 pm

Re: Projection of Wire on Mesh

Post by HakanSeven12 »

wmayer wrote: Wed Jun 26, 2019 3:46 pm Ping
I can create projected wire like this by using Mesh.crossSections. But I can't finish projected wire at base wire last point.



crossSection.png
crossSection.png (145.79 KiB) Viewed 1066 times

Code:

Code: Select all

import MeshPart, Draft

GuideLinesGroup = FreeCAD.ActiveDocument.Test.Group
SectionGroup = FreeCAD.ActiveDocument.Group
CopyMesh=App.ActiveDocument.Surface.Mesh.copy()
Base = CopyMesh.Placement.Base
CopyMesh.Placement.move(Base.negative())

for Wire in GuideLinesGroup:
	CopyShape=Wire.Shape.copy()
	CopyShape.Placement.move(Base.negative())

	Vec = CopyShape.Edge1.Vertexes[0].Point - CopyShape.Edge1.Vertexes[1].Point
	Vec.x, Vec.y = -(Vec.y), Vec.x

	Section = CopyMesh.crossSections([(CopyShape.Edge1.Vertexes[0].Point,Vec)],0.000001)
	print(Section)

	for i in Section[0]:
		Pwire = Draft.makeWire(i)
		Pwire.Placement.move(Base)
		SectionGroup.addObject(Pwire)

FreeCAD.ActiveDocument.recompute()
wmayer
Founder
Posts: 20324
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Projection of Wire on Mesh

Post by wmayer »

With git commit 115ff0191 everything works now.
User avatar
HakanSeven12
Veteran
Posts: 1481
Joined: Wed Feb 06, 2019 10:30 pm

Re: Projection of Wire on Mesh

Post by HakanSeven12 »

wmayer wrote: Thu Jun 27, 2019 5:29 pm With git commit 115ff0191 everything works now.
Does same macro work or I need to change something?
Last edited by HakanSeven12 on Thu Jun 27, 2019 5:41 pm, edited 1 time in total.
wmayer
Founder
Posts: 20324
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Projection of Wire on Mesh

Post by wmayer »

Same macro.
User avatar
HakanSeven12
Veteran
Posts: 1481
Joined: Wed Feb 06, 2019 10:30 pm

Re: Projection of Wire on Mesh

Post by HakanSeven12 »

Okey I will try when next build available
User avatar
HakanSeven12
Veteran
Posts: 1481
Joined: Wed Feb 06, 2019 10:30 pm

Re: Projection of Wire on Mesh

Post by HakanSeven12 »

wmayer wrote: Thu Jun 27, 2019 5:41 pmSame macro.
It works :) Thank you so much


sections.png
sections.png (141.69 KiB) Viewed 975 times
Post Reply