Arch Fence

A forum dedicated to the Draft, Arch and BIM workbenches development.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
engdham
Posts: 47
Joined: Sun Jul 15, 2018 2:08 am
Location: Rondonópolis - MT - Brazil
Contact:

Re: Arch Fence

Post by engdham »

Can a sketch profile be used for the fence post? Maybe this could become a drywall/light steel frame panel constructor:


https://cursospro.info/wp-content/uploa ... -Revit.jpg
User avatar
furti
Posts: 344
Joined: Mon Nov 27, 2017 5:27 pm

Re: Arch Fence

Post by furti »

engdham wrote: Thu May 09, 2019 12:22 am sketch profile be used for the fence post
Not with the current version. But the plan is to make this possible in the future. :)
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Documenting Arch Fence

Post by vocx »

furti wrote: Sun May 12, 2019 5:35 am I think @vocx updated the workbench page. Thanks for doing so :)
Two things.

I think ArchFence.py should import Part explicitly at the beginning. Otherwise you get an undefined Part error.

Code: Select all

Traceback (most recent call last):
  File "/home/ecc/.FreeCAD/Mod/Arch/ArchFence.py", line 101, in execute
    obj, postPlacements, postLength, sectionLength)
  File "/home/ecc/.FreeCAD/Mod/Arch/ArchFence.py", line 173, in calculateSections
    sectionCopy, sectionLength, sectionLine.length() - postLength)
  File "/home/ecc/.FreeCAD/Mod/Arch/ArchFence.py", line 188, in clipSection
    leftBox = Part.makeBox(halfLengthToCut, boundBox.YMax + 1, boundBox.ZMax + 1,
<class 'NameError'>: name 'Part' is not defined
Second, I think that for consistency the user tool should be called makeFence() instead of buildFence(). Almost all commands that construct an object in FreeCAD, and in Arch, follow that pattern, makeSomething()

Also, personally, I would add default values like

Code: Select all

def makeFence(section="simple_bars", post="rectangular", path="straight"):
Where the default values indicate simple presets, like your example at the end or in the wiki (Arch Fence).

At the end of that command, it should return the object, so the user can manipulate it further.

Code: Select all

    return obj
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
User avatar
furti
Posts: 344
Joined: Mon Nov 27, 2017 5:27 pm

Re: Documenting Arch Fence

Post by furti »

@vocx thanks a lot for your suggestions.

vocx wrote: Mon May 13, 2019 11:35 pm I think ArchFence.py should import Part explicitly at the beginning. Otherwise you get an undefined Part error.
I fixed the missing Part Import now in the clipping method. I did not Import the Part module at the beginning, because other Arch commands do not do this either. I think this is because otherwise the Part module would be imported right when the Arch Workbench gets started, even when you do not use any of the tools inside.
vocx wrote: Mon May 13, 2019 11:35 pm Second, I think that for consistency the user tool should be called makeFence()
That is 100 percent correct. I changed the name of it.

vocx wrote: Mon May 13, 2019 11:35 pm I would add default values like
I think this can be done when a preset functionality is added to the fence. Right now there is nothing that can handle the default values.

vocx wrote: Mon May 13, 2019 11:35 pm At the end of that command, it should return the object
Shame on me that I missed that. :lol: Added the return statement now.


I created a pull request for the two fixes. https://github.com/FreeCAD/FreeCAD/pull/2173
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Documenting Arch Fence

Post by vocx »

furti wrote: Tue May 14, 2019 3:58 pm I fixed the missing Part Import now in the clipping method. I did not Import the Part module at the beginning, because other Arch commands do not do this either. I think this is because otherwise the Part module would be imported right when the Arch Workbench gets started, even when you do not use any of the tools inside.
Although I know other Arch commands import the Part module in the functions, I think this is in fact terrible. Imports in Python should be done at the top of the file. It is basically impossible to build any geometry without importing it first, so the import should happen at the top anyway.
vocx wrote: Mon May 13, 2019 11:35 pm I would add default values like
I think this can be done when a preset functionality is added to the fence. Right now there is nothing that can handle the default values.
Just like the Arch Window, you could define a makeFencePreset() function that creates a standard fence from a couple of hard coded presets.

https://github.com/FreeCAD/FreeCAD/blob ... ow.py#L120

A simple preset could be the one that you put in your example, under if __name__.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
User avatar
furti
Posts: 344
Joined: Mon Nov 27, 2017 5:27 pm

Re: Arch Fence

Post by furti »

Added an option to use the Colors of the original section and fence post.

When Setting the shape Color of the fence, the whole fence is colored with the same Color
ShapeColor.png
ShapeColor.png (32.37 KiB) Viewed 2095 times
The Pull Request adds the "UseOriginalColors" Option to the Fence ViewObject.
UseOriginalColors.png
UseOriginalColors.png (26.65 KiB) Viewed 2095 times
When set to "true", the fence will inherit the Colors of the original section and post
colored_fence.png
colored_fence.png (30.6 KiB) Viewed 2095 times
You can simply set a Shape Color for the post and section or you can even colorize all faces of the post and section individually.

I created a Pull Request for this: https://github.com/FreeCAD/FreeCAD/pull/2263
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Arch Fence

Post by yorik »

Great addition! Merged.
User avatar
furti
Posts: 344
Joined: Mon Nov 27, 2017 5:27 pm

Re: Arch Fence

Post by furti »

Created another pull request that fixes some Problems with the colorization Option for the fence. https://github.com/FreeCAD/FreeCAD/pull/2270


Also uploaded some Images here of a Fence I made with the tool (https://forum.freecadweb.org/viewtopic.php?f=24&t=37121) :)
engdham
Posts: 47
Joined: Sun Jul 15, 2018 2:08 am
Location: Rondonópolis - MT - Brazil
Contact:

Re: Arch Fence

Post by engdham »

Would this tool allow to build something like this?
Plataforma.png
Plataforma.png (37.19 KiB) Viewed 1968 times
I'm thinking about an industrial plant building, with lots of handrails.
User avatar
furti
Posts: 344
Joined: Mon Nov 27, 2017 5:27 pm

Re: Arch Fence

Post by furti »

I think it should be possible to do.

I think we have to put some effort in the details like the corners and smaller sections.
Until now the sections are simply clipped when they need to be smaller than the original one.

But maybe you can give it a try and we can figure out what needs to be improved to handle this workflow.
Post Reply