[Working Macro][work in progress] Curved Path Stairs

A forum dedicated to the Draft, Arch and BIM workbenches development.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
paullee
Veteran
Posts: 5098
Joined: Wed May 04, 2016 3:58 pm

Re: [Working Macro][work in progress] Curved Path Stairs

Post by paullee »

balrobs wrote: Tue Jan 25, 2022 4:31 pm Unfortunately the profile drawing is quite a tedious task ... maybe it could make sense to automate this in some way ... being in sketcher would then allow the user to make fine adjustments
Yes hopefully these could be automated :)

Do you find the mapping of steps 'proportionally' - so each tread width is as expected ?

How about in comparison the behaviour of the original Macro in OP ? Thanks.
balrobs
Posts: 449
Joined: Fri Apr 24, 2020 8:58 pm

Re: [Working Macro][work in progress] Curved Path Stairs

Post by balrobs »

paullee wrote: Tue Jan 25, 2022 11:11 pm Do you find the mapping of steps 'proportionally' - so each tread width is as expected ?
On linear path segments steps are mapped proportionally, but not on curved :evil:
stair_step_mapping.jpg
stair_step_mapping.jpg (72.09 KiB) Viewed 1738 times
paullee wrote: Tue Jan 25, 2022 11:11 pm How about in comparison the behaviour of the original Macro in OP ?
Although I tried a lot of combinations (alignment: left/rigt, inner path/outer path) I'm not able to build my last stair with the original Macro :x
stair_strange_result.png
stair_strange_result.png (16.43 KiB) Viewed 1738 times
paullee
Veteran
Posts: 5098
Joined: Wed May 04, 2016 3:58 pm

Re: [Working Macro][work in progress] Curved Path Stairs

Post by paullee »

balrobs wrote: Wed Jan 26, 2022 9:38 am On linear path segments steps are mapped proportionally, but not on curved :evil:
stair_step_mapping.jpg
Hmmm, studied your model, really no idea the algorithm / logic behind MapSketchOnSurface :lol:

If something could be automated, this 'algorithm' is one of the choice in generate the 'sectional profile' 'as it is' for user ?

EDIT : @Abeton's macro created consistent tread length :)

Maybe any others has more ideas ?


2nd EDIT - Noted you have some discussion in the Curve Workbench thread
balrobs
Posts: 449
Joined: Fri Apr 24, 2020 8:58 pm

Re: [Working Macro][work in progress] Curved Path Stairs

Post by balrobs »

paullee wrote: Thu Jan 27, 2022 5:26 pm 2nd EDIT - Noted you have some discussion in the Curve Workbench thread
Yes, Chris_G kindly pointed out to me how to manage a non-deformed mapping of the stair profile onto a general curved surface.
This way I can control the layout of the steps with sketches, but at the cost of increasing workload and some inaccuracies due to the discretisation.
Cheers
CurvdStair_90deg.jpg
CurvdStair_90deg.jpg (67.37 KiB) Viewed 1628 times
Attachments
CurvdStair_90deg.FCStd
(233.72 KiB) Downloaded 24 times
User avatar
Roy_043
Veteran
Posts: 8452
Joined: Thu Dec 27, 2018 12:28 pm

Re: [Working Macro][work in progress] Curved Path Stairs

Post by Roy_043 »

One simple way to improve the computation time of the CurvedStairRC.FCMacro macro is to collect the solids for each stair in a list, and fuse them in a single operation.

Before:
Task finished in 57.43 seconds!
After:
Task finished in 22.09 seconds!
Attachments
CurvedStairRC_001.FCMacro
(14.01 KiB) Downloaded 28 times
User avatar
Roy_043
Veteran
Posts: 8452
Joined: Thu Dec 27, 2018 12:28 pm

Re: [Working Macro][work in progress] Curved Path Stairs

Post by Roy_043 »

Another bottleneck is the use of Part.makeRuledSurface(). Avoiding it for the top of each stair also improves the computation time. Note that I have implemented this in a rather Q&D manner.

Before:
Task finished in 23.71 seconds!
After:
Task finished in 7.76 seconds!
Attachments
CurvedStairRC_002.FCMacro
(14.28 KiB) Downloaded 25 times
paullee
Veteran
Posts: 5098
Joined: Wed May 04, 2016 3:58 pm

Re: [Working Macro][work in progress] Curved Path Stairs

Post by paullee »

balrobs wrote: Fri Jan 28, 2022 2:44 pm Yes, Chris_G kindly pointed out to me how to manage a non-deformed mapping of the stair profile onto a general curved surface.
This way I can control the layout of the steps with sketches, but at the cost of increasing workload and some inaccuracies due to the discretisation.
Thanks! @Chris_G 'slightly' elaborated the algorithm of MapSketchOnSurface which is way far too difficult for me :lol:

And @Roy_43 improvement in the performance of the code is really impressive :D
paullee
Veteran
Posts: 5098
Joined: Wed May 04, 2016 3:58 pm

Re: [Working Macro][work in progress] Curved Path Stairs

Post by paullee »

Based on your Macro, attempting slighting different approach :
- create side profiles (both sides) of each treads based on the edges created in the original Macro
- (proof of concept in the meantime only, so actually the top level surface is not done yet - more like a ramp now)
- and makeLoft, so there is only 1 makeLoft for each step, before fusing, boolean

Would it save time ?

However, it seem the points generated are slightly not coplanar so makeLoft do not create solids ?... needs more time to have a better look :)

Anyone like to comment if this approach would save some time ? Or would follow experimenting this approach ?

CurvedStairRC_002_By-Roy_043_Paul.FCMacro
(15.15 KiB) Downloaded 25 times
Screenshot from 2022-01-29 12-29-12.png
Screenshot from 2022-01-29 12-29-12.png (310.27 KiB) Viewed 1461 times
Screenshot from 2022-01-29 12-23-26.png
Screenshot from 2022-01-29 12-23-26.png (231.93 KiB) Viewed 1461 times
paullee
Veteran
Posts: 5098
Joined: Wed May 04, 2016 3:58 pm

Re: [Working Macro][work in progress] Curved Path Stairs

Post by paullee »

Test_ CurvedStairRC_LoftApproach_rr_ 01.FCStd
(896.51 KiB) Downloaded 20 times
balrobs
Posts: 449
Joined: Fri Apr 24, 2020 8:58 pm

Re: [Working Macro][work in progress] Curved Path Stairs

Post by balrobs »

Roy_043 wrote: Fri Jan 28, 2022 7:05 pm Before:
Task finished in 23.71 seconds!
After:
Task finished in 7.76 seconds!
Impressive, almost four times as fast! :shock:
Probably still too slow to make a FreeCAD parametric object out of it, but already quite usable as a macro.
If I find some time, I will try to work on some kind of progress indicator in order to mitigate the response delay.
Thanks Roy_043 for your valuable contribution!
Post Reply