Structure in xz-plane

A forum dedicated to the Draft, Arch and BIM workbenches development.
User avatar
rockn
Posts: 1539
Joined: Wed Sep 28, 2011 10:39 am
Location: Toulouse, France
Contact:

Re: Structure in xz-plane

Postby rockn » Sat Dec 26, 2015 12:21 pm

Hello,
To get the normal automatically my workflow is the following :
Draw a Draft/Dwire on whatever working plane.
Set the Make Face property of the Dwire to true.
Select the face and use Draft/Trim to make an extrude (the extrude will be normal to the face and you can choose the direction).
Then I create a structure from the Extrude object.
Formations et tutoriels FreeCAD en Français, soutenez moi : https://www.tipeee.com/formations-freecad
JAndersM
Posts: 53
Joined: Tue Dec 22, 2015 1:35 pm

Re: Structure in xz-plane

Postby JAndersM » Sat Dec 26, 2015 4:42 pm

Ok!
Select the face and use Draft/Trim to make an extrude (the extrude will be normal to the face and you can choose the direction).
That gave me an idea. I checked the code for Draft extrude and then I changed the line 607 in ArchStructure.py to replicate the one that is used in DraftTools, normal=obj.Base.Shape.Faces[0].normalAt(.5,.5) :

Code: Select all

                if not base:
                    if not height:
                        return
                    if obj.Normal == Vector(0,0,0):
                        #Old line p = FreeCAD.Placement(obj.Base.Placement)
                        #Old line normal = p.Rotation.multVec(normal) 
                        normal=obj.Base.Shape.Faces[0].normalAt(.5,.5)
                    else:
                        normal = Vector(obj.Normal)
Now Structures work for Circles, Rectangles. Polygons and also b-splines and closed DWires in the same way. Extruding normal to the face by default.

Might be useful for others as well. (If there’s no adverse effects that pops up!)