Projecting curve onto face

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Projecting curve onto face

Post by DeepSOIC »

pojection-quick-test.png
pojection-quick-test.png (15.2 KiB) Viewed 1571 times

Code: Select all

>>> sph=App.ActiveDocument.Sphere.Shape
>>> sph.makePerspectiveProjection(App.ActiveDocument.Sketch.Shape,App.Vector(0,0,0))
<Shape object at 00000081E33641F0>
>>> prj=sph.makePerspectiveProjection(App.ActiveDocument.Sketch.Shape,App.Vector(0,0,0))
>>> Part.show(prj)
EDIT: result is rather strange. 8 wires, which correspond to edges of sketch projected onto close and far surfaces... Needs filtering.

Code: Select all

Selected document object:
  Name = Shape
  Label = Shape
  Is Lattice = False
Structure: 
Compound (8 objects):
    Wire (1 segments)
    Wire (1 segments)
    Wire (2 segments)
    Wire (1 segments)
    Wire (1 segments)
    Wire (1 segments)
    Wire (1 segments)
    Wire (2 segments)
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Projecting curve onto face

Post by DeepSOIC »

Further investigation.
projection-quick-test-numbered.png
projection-quick-test-numbered.png (25.01 KiB) Viewed 1564 times
projection-quick-test.FCStd
(69.36 KiB) Downloaded 84 times
The numbers next to sketch show its edge numbering. Numbers next to projection are indexes of wires (some wires are split into two edges by interference with sphere's seam edge).

Edges are BSplineCurves.
ujjwal
Posts: 6
Joined: Sat Dec 19, 2015 11:10 am

Re: Projecting curve onto face

Post by ujjwal »

Thank You DeepSoic,

I am attaching two files to elaborate my problem.
PROJECT.FCStd
(10.79 KiB) Downloaded 83 times
Is the base state from where i will start. The two dimensional shape has the same length along the y-axis as that of the arc length of the toroidal surface.
EXTRUDE.FCStd
(19.68 KiB) Downloaded 55 times
If i do the simple extrusion, I am unable to get the desired SOLID, as the extrudate is falling out side the revolved toroid.

Regards
Ujjwal
User avatar
nmt
Posts: 29
Joined: Sun Feb 19, 2017 2:45 pm

Re: Projecting curve onto face

Post by nmt »

Hello,
I am getting similar results. In the attached images, I project a face unto a cylinder. Both sit on the XY-plane. So, in addition to two projections on the near and far surfaces, I am getting a projection on the bottom of the cylinder. I cannot filter the resulting wires because their edges are not logically grouped. In this example, I get two wires. The first wire has 7 edges (highlighted in green) and the second wire has 1 edge (in black on the bottom face). Any help in resolving this is much appreciated.

Code: Select all

import Part

doc = FreeCAD.newDocument('NMT-Explode')
Gui.ActiveDocument.ActiveView.viewAxonometric()


# CREATE A FACE
v1 = App.Vector(7.0,-0.5,0.0)
v2 = App.Vector(7.0,0.5,0.0)
v3 = App.Vector(7.0,0.5,2.5)
v4 = App.Vector(7.0,-0.5,2.5)
edge1 = Part.makeLine(v1, v2)
edge2 = Part.makeLine(v2, v3)
edge3 = Part.makeLine(v3, v4)
edge4 = Part.makeLine(v4, v1)
wire = Part.Wire([edge1,edge2,edge3,edge4])
face = Part.Face(wire)
Part.show(face)

# CREATE A CYLINDER
cylinder = Part.makeCylinder(4,6,App.Vector(0,0,0))
Part.show(cylinder)
doc.ActiveObject.ViewObject.Transparency=50

# PROJECT EVERY WIRE IN FACE UNTO THE CYLINDER
for w in range(len(face.Wires)):
	projection=c.makeParallelProjection(face.Wires[w], App.Vector(-1,0,0))
	Part.show(projection)

Gui.SendMsgToActiveView("ViewFit")
ProjectFaceOnCylinder.png
ProjectFaceOnCylinder.png (47.35 KiB) Viewed 1286 times
Post Reply