Structure in xz-plane

A forum dedicated to the Draft, Arch and BIM workbenches development.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
rockn
Veteran
Posts: 1791
Joined: Wed Sep 28, 2011 10:39 am
Location: Toulouse, France
Contact:

Re: Structure in xz-plane

Post by rockn »

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 - Assistance - Développement : https://freecad-france.com
JAndersM
Posts: 63
Joined: Tue Dec 22, 2015 1:35 pm

Re: Structure in xz-plane

Post by JAndersM »

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!)
Post Reply