The shape generated by makepipe is weird.

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
JOE_FU
Posts: 79
Joined: Fri Jan 11, 2019 8:41 am

The shape generated by makepipe is weird.

Post by JOE_FU »

I defined a shape of wire and a shape of face.
I want to get the shape by using makePipe.
But the final shape is weird.What's wrong with it?
Attachments
LineAndArea.png
LineAndArea.png (2.78 KiB) Viewed 760 times
finalShape.png
finalShape.png (2.11 KiB) Viewed 760 times
chrisb
Veteran
Posts: 54293
Joined: Tue Mar 17, 2015 9:14 am

Re: The shape generated by makepipe is weird.

Post by chrisb »

No FreeCAD info, no file attached, no exact step by step description - how can we help? Perhaps you can try to find a solution here: http://cdn2.spiegel.de/images/image-730 ... -73031.jpg
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
JOE_FU
Posts: 79
Joined: Fri Jan 11, 2019 8:41 am

Re: The shape generated by makepipe is weird.

Post by JOE_FU »

chrisb wrote: Sat May 25, 2019 8:00 am No FreeCAD info, no file attached, no exact step by step description - how can we help? Perhaps you can try to find a solution here: http://cdn2.spiegel.de/images/image-730 ... -73031.jpg
Sorry, it's my fault. I just posted my code.

Code: Select all


class ConformalArea:
    def __init__(self, obj):
        obj.addProperty("App::PropertyVectorDistance", "Point1", "Object of a ConformalArea",
                        "Point1 of the ConformalArea").Point1 = FreeCAD.Vector(0.86, 0.5, 0)
        obj.addProperty("App::PropertyVectorDistance", "Point2", "Object of a ConformalArea",
                        "Point2 of the ConformalArea").Point2 = FreeCAD.Vector(0.86, 0.5, 2)
        obj.addProperty("App::PropertyAngle", "starAngle", "", "").starAngle = 30
        obj.addProperty("App::PropertyAngle", "endAngle", "", "").endAngle = 90
        obj.addProperty("App::PropertyFloat","Radius","","").Radius = 1
        obj.Proxy = self

    def execute(self, fp):
        line = Part.makeLine(fp.Point1, fp.Point2)
        linePath = Part.makeCircle(fp.Radius + 0.001, FreeCAD.Vector(0, 0, fp.Point2.z), FreeCAD.Vector(0, 0, 1),
                                   fp.starAngle, fp.endAngle)
        path = Part.Wire(linePath)
        fp.Shape = path.makePipe(line)




class Line:
    def __init__(self,obj):
        obj.addProperty("App::PropertyVectorDistance", "Point1", "Object of a ConformalLine","Point1 of the ConformalLine").Point1 = FreeCAD.Vector(0.86, 0.5, 0)
        obj.addProperty("App::PropertyVectorDistance", "Point2", "Object of a ConformalLine","Point2 of the ConformalLine").Point2 = FreeCAD.Vector(1.7, 1, 0)
        #obj.addProperty("App::PropertyVectorDistance", "Point1", "Object of a ConformalLine","Point1 of the ConformalLine").Point1 = FreeCAD.Vector(0, 0.5, 0)
        #obj.addProperty("App::PropertyVectorDistance", "Point2", "Object of a ConformalLine","Point2 of the ConformalLine").Point2 = FreeCAD.Vector(2, 1, 0)
        obj.Proxy = self

    def execute(self, fp):
        fp.Shape=Part.makeLine(fp.Point1,fp.Point2)



obj1 = FreeCAD.ActiveDocument.addObject("Part::FeaturePython","ConformalArea")
ConformalArea(obj1)
obj1.ViewObject.Proxy=0
FreeCAD.ActiveDocument.recompute()

obj2 = FreeCAD.ActiveDocument.addObject("Part::FeaturePython","Line")
Line(obj2)
obj2.ViewObject.Proxy=0
FreeCAD.ActiveDocument.recompute()

path=Part.Wire(obj2.Shape)

obj=path.makePipe(obj1.Shape)
Part.show(obj)
Attachments
MyShape.png
MyShape.png (8.64 KiB) Viewed 699 times
User avatar
Chris_G
Veteran
Posts: 2601
Joined: Tue Dec 31, 2013 4:10 pm
Location: France
Contact:

Re: The shape generated by makepipe is weird.

Post by Chris_G »

At the end of your script :

Code: Select all

obj=path.makePipe(obj1.Shape)
Here, obj1.Shape is a shell.
You should explicitly use a wire or an edge:

Code: Select all

obj=path.makePipe(obj1.Shape.Wires[0])
JOE_FU
Posts: 79
Joined: Fri Jan 11, 2019 8:41 am

Re: The shape generated by makepipe is weird.

Post by JOE_FU »

Chris_G wrote: Mon May 27, 2019 12:54 pm At the end of your script :

Code: Select all

obj=path.makePipe(obj1.Shape)
Here, obj1.Shape is a shell.
You should explicitly use a wire or an edge:

Code: Select all

obj=path.makePipe(obj1.Shape.Wires[0])
Thank you very much.It is normal.But why is this shape not closed? :?:
Attachments
Shape.png
Shape.png (1.89 KiB) Viewed 673 times
JOE_FU
Posts: 79
Joined: Fri Jan 11, 2019 8:41 am

Re: The shape generated by makepipe is weird.

Post by JOE_FU »

JOE_FU wrote: Mon May 27, 2019 1:05 pm
Chris_G wrote: Mon May 27, 2019 12:54 pm At the end of your script :

Code: Select all

obj=path.makePipe(obj1.Shape)
Here, obj1.Shape is a shell.
You should explicitly use a wire or an edge:

Code: Select all

obj=path.makePipe(obj1.Shape.Wires[0])
Thank you very much.It is normal.But why is this shape not closed? :?:
When I use the makePipeShell function, why are some models closed and some models not closed?
Post Reply