## [Solved]Projection of Wire on Mesh

Need help, or want to share a macro? Post here!
HakanSeven12
Posts: 771
Joined: Wed Feb 06, 2019 10:30 pm

### [Solved]Projection of Wire on Mesh

How can I create a parallel projection of a wire on a mesh surface like this?
(Green line is mesh, red one is projected wire and black one is first wire)

Projection.png (5.58 KiB) Viewed 496 times
Last edited by HakanSeven12 on Sun Sep 08, 2019 7:00 pm, edited 4 times in total.
Joel_graff
Posts: 1729
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

### Re: Projection of Wire on Mesh

@microelly2 can probably answer that one.
microelly2 wrote: ping

pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
jbi
Posts: 57
Joined: Sun Apr 24, 2016 3:28 pm

### Re: Projection of Wire on Mesh

maybe a solution would be : Extrude a wire or edge with Part -> convert to mesh via STL -> mesh.intersect(STL)
microelly2
Posts: 4690
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

### Re: Projection of Wire on Mesh

First convert the mesh to a part
than you can apply the makeParallelProjection method to each face and your wire

>>> f=App.ActiveDocument.Box.Shape.Face1

>>> f.makeParallelProjection.__doc__
'Parallel projection of an edge or wire on this shape\nmakeParallelProjection(shape, dir)\n '

>>> f.makePerspectiveProjection.__doc__
'Perspective projection of an edge or wire on this shape\nmakePerspectiveProjection(shape, pnt)\n '

see for more discussion here
wmayer
Posts: 15763
Joined: Thu Feb 19, 2009 10:32 am

### Re: Projection of Wire on Mesh

git commit c60658f3f

Code: Select all

``````shape = ...
mesh = ...
projectionDir = App.Vector(...)

import MeshPart
import Part
polylines = MeshPart.projectShapeOnMesh(shape, mesh, projectionDir)

for i in polylines:
Part.show(Part.makePolygon(i))
``````
HakanSeven12
Posts: 771
Joined: Wed Feb 06, 2019 10:30 pm

### Re: Projection of Wire on Mesh

I will try it when next 0.19_pre build is available
Last edited by HakanSeven12 on Sun May 19, 2019 10:16 am, edited 1 time in total.
HakanSeven12
Posts: 771
Joined: Wed Feb 06, 2019 10:30 pm

### Re: Projection of Wire on Mesh

wmayer wrote:
Tue May 14, 2019 1:24 pm
git commit c60658f3f

Code: Select all

``````shape = ...
mesh = ...
projectionDir = App.Vector(...)

import MeshPart
import Part
polylines = MeshPart.projectShapeOnMesh(shape, mesh, projectionDir)

for i in polylines:
Part.show(Part.makePolygon(i))
``````
I tried it. If all wire points drop on mesh its create projection wires. But if wire points does not drop on mesh its return empty list.

first.png (112.9 KiB) Viewed 661 times

second.png (118.95 KiB) Viewed 661 times
wmayer
Posts: 15763
Joined: Thu Feb 19, 2009 10:32 am

### Re: Projection of Wire on Mesh

HakanSeven12
Posts: 771
Joined: Wed Feb 06, 2019 10:30 pm

### Re: Projection of Wire on Mesh

I will try it in the next windows build
Last edited by HakanSeven12 on Tue May 28, 2019 11:34 am, edited 1 time in total.
HakanSeven12
Posts: 771
Joined: Wed Feb 06, 2019 10:30 pm

### Re: Projection of Wire on Mesh

wmayer wrote:
Sun May 19, 2019 5:11 pm
git commit b17a784e3
I tried. We talked about it but for topic:

Funchtion is creating projection if wire edge down on mesh, but if wire edge lie outside of mesh projection wire dont extend to mesh border.

Like this(Black one is original wire under mesh and red one is projected wire)

Projection.png (151.48 KiB) Viewed 543 times