[PR] [0.18-0.21_pre] Arch Stair - More Geometry Control? Profile Generator

[u]EDIT: 0.21_pre - https://forum.freecad.org/viewtopic.php?p=675984#p675984[/u]
EDIT: Riser Thickness, 31.3.2019

Hi, I am trying the Arch Stair (again).

The settings are great to automatically generate a stair.

I find the need to set the length of the intermediate landing, but it seems there is nothing in the combo data tab nor wiki.

Possible to control it somewhere? Through python script?
Screenshot from 2018-06-19 06-27-34.png

Basically at the moment the length of the landing is calculated by taking the total length of the stairs baseline and subtracting the total length of steps. But the stairs tool was never carried very far, it needs a lot of work yet…

Thanks!

I attempt to understand the code, though farrrrrrrr from understanding the whole, it is noted obj.Width.Value is used for the ‘landing depth’.

I try introduced ‘Landing Depth’ property and add in essence the following… prima facia it works… now if ‘Landing Depth’ is not ‘0’, the landing depth follow this input.

The whole modified file attached (ArchStairs.py), see if it helps and any problem (I do not understand most of other code/calculation) … I would try an alternative to calculate the stair length / height based on input of individual tread and riser…

        if obj.LandingDepth:
            reslength = edge.Length - obj.LandingDepth.Value
        else:
            reslength = edge.Length - obj.Width.Value

p.s.
I can only use gedit and without more knowledge in programming best practice, I add ‘by paul’ to signify the changes made.

set at ‘0’


set at ‘1000’

set at ‘2000’

ArchStairs.py (25 KB)

That seems very good!

Would you like to make a pull request on github and become an official FreeCAD developer? :wink:

Hi, no problem to share anything I can manage to contribute if found helpful.

In the meantime, I never and haven’t learned how to use github (except download FC :slight_smile: ).

Before then, the revision of code was attached in last post.

@chrisb started a great thread about learning how to use git and GitHub (can’t find it ATM). There is also a short tutorial on the wiki github
Feel free to ask queations, folks are happy to help as you know

Do you mean this: https://forum.freecadweb.org/viewtopic.php?f=10&t=23204&start=10#p197792 ?

Hi, thanks all for the information!

There are lots to read in fact, it’s fun though… I started to read python, workbench creation, may need to learn gimp/inkscape to draw icon, since I found FC trying to learn something that maybe like Revit or ArchiCAD (both I never use) … and like Yorik once comment ‘end up coding’ - though I am never and far far far from being a programmer of any kind (I had a book on 6502 assembly / machine code you won’t believe it, if anyone know what is 6502) :wink:

Spent/Spending lots of time figuring out how python basic works and ‘experimenting’ how to use Sketch (SketchPython) + ArchWall to build floor layout in a better workflow that is easier for design revision… haven’t really started a real model for any project / assignment yet… hoping something is useful in the end for this 'experiment.

Thanks again!

Hi, just drop into earlier discussion (again) noting Arch Structure already has a Precast Stair which calculate based on input tread and riser! No need to attempt any code myself :smiley:

(Thank Joancabeza who bring this up again)

The Precast Stair code is more straightforward for me to understand, though it apparently lacks some features like stringer, nosing (which I do not need at the moment).

Now if I manage to, and with some time, I would attempt a vertical stairwell with intermediate landing (rather than a straight flight with a landing that can be done now in Arch Stair).

Any thought how you would like / have planned to do / develop further with these 2 approach of Stairs (Arch Structure Precast Stair / Arch Stair)?


Hi, further ‘experiment’ below which turn ArhcStair._Stairs.makeStraightStairsWithLanding(self,obj,edge) into kind of frankenstein…

I am testing introducing another property (Flight = “Straight” or “Return”). Now a straight staircase with a landing would ‘return’ in opposite direction after landing if “Return” is selected, some progress… with some queries and maybe comments needed to further develop if find useful.

  1. 1st simple English Q: What is correct terminology for this typology of staircase? I am afraid ‘Return’ is not the correct term.
  2. The makeStraightStairsWithLanding(self,obj,edge) is ‘manipulated’ to make this happen - I do not have full picture of the Arch / ArchStair / ArchPrecast (another query in last post) and have no better idea what to do if I want to introduce this ‘feature’.
  3. I have a glance at YouTube how Revit is working with stairs and found the stairs ‘components’ could be edited individually after creation… I am thinking if another experiment I am having a SketchPython to create a nos. of ArchWall may work similarly… or if there is already a plan and idea to work in this direction or another?

You can see the landing is not totally ‘correct’ as there is bit sticking out… other parameters like Structure Offset would not works together nicely etc etc… Just an experiment.

“Experiment” ArchStair.py attached
Screenshot from 2018-06-23 18-20-49.png
Flight == “Return”
Screenshot from 2018-06-23 18-21-23.png
ArchStairs.py (26.2 KB)

Hi, some further idea that control / generate staircase below, see any people has comments on experimenting this direction… (currently ArchStair seem ignore a wire of say L-shaped…)

Idea and Experiment Attached

  1. To compose a stair of more complicated form (still considering a combination of straight flights and turns only) instead of let an ArchStair do it in one go, it can be a series of Additions (inherent feature of Arch Components / objects)… see screencapture
  2. Now, each ArchStair generate a flight, a landing, another flight… based on a series of individual edge ( in a ‘mastersketch’ e.g. - see below for more issues)
  3. Then, each of these flights could have finer control e.g. different tread, riser, width etc.
  4. Also, potentially, as noted in a Revit Youtube tutorial, the landing form/outline could be generated by a sketch, trapezoid etc…
  5. A ‘Master’ Arch Stair object now ‘host’ these segments of Stair Components
  6. Maybe a ‘Stair Kerb’, ‘Stair Railing’ etc. objects could be created and added to / hosted by this ‘Master Arch Stair’ Object
  7. (Similar idea for other Arch Objects in general? ‘Window Mullion/Transom’, ‘Window Glass Panels’ objects in Arch Window …? ‘Rebar Object’, ‘Metal Lathing’, ‘Mortar’ in ‘Wall Object’… ‘Stud’, ‘Cladding’ in ‘Wall Panel’… etc.)
  8. The disposition / placement of Landing_1 depends on the height / resultant height of Flight_1, Flight_2 depends on Landing_1, so on… currently by expression

Now, edit the underlying ‘MasterSketch’, the whole staircase geometry follows. Edit individual ‘Stair Component’, the ‘Master Arch Stair’ composed the updated geometry.

Better WorkFlow and Pre-requisites

  1. Currently, seem Arch Stair only accept 1 straight wire / edge, that’s fine at the moment.
  2. To have a series of connecting individual edge for each ‘Stair Components’, it can be drawn and updated ‘manually’, or,
  3. Make life easier a ‘master sketch’ that includes the whole skeleton of the stair and ‘output’ individual wires for each individual stair flights/lands could be adopted - issues below

‘Master Sketch’ Issues / Potential Solutions

  1. Currently 2 issues at least to my knowledge
  2. 1st not really a problematic one -Arch Stair need to accept something like sketch.edges[9], or wires[3] for individual components…or…
  3. 2nd a ‘Master Sketch’ export individual edge. But current associated problem being ‘kind of topological naming issue of sketch’ - delete an edge in it, the index of a wire change - so sketch.edges[12] (pseudo) is prone to break
  4. ‘Luckily’, Realthunder’s implementation should solves these - 1/ the naming of edge become consistent, 2/ it has ‘feature’ of ‘Sketch Export’ so individual edges could be use with ease
    https://forum.freecadweb.org/viewtopic.php?f=22&t=27215&start=10#p222807
  5. I am using my experimental ‘ArchSketch’ which use ‘tag’ for each edges therefore (semi)-consistent, and which could somehow ‘output’ selected edges to other Sketch… currently used in experiment file attached.
    Same discussion, different post https://forum.freecadweb.org/viewtopic.php?f=22&t=28575#p234518
  6. ‘Unluckily’, I am not aware of Reathunder’s works been merged?

(Don’t bother the strange form of Landing_1, just an experiment / proof of concept)

Screenshot from 2018-06-25 02-39-57.png
Screenshot from 2018-06-25 02-46-08.png
Screenshot from 2018-06-25 02-47-07.png
Screenshot from 2018-06-25 02-46-18.png
Test_ ArchStairs_ code revision test_ 2.fcstd (47.4 KB)

You are right that the stairs tool is already pretty complicated even when it is still very basic. I believe the complexity can easily grow to some absurd levels (all BIM apps out there present serious problems with stairs…)

Indeed a modular approach is certainly a good path. But even so there are so many situations like the landing shape must be slightly different if there is a stair flight next or not, and depend on the type of that stairs flight, etc… That quickly you’ll get back to the same level of complexity I think. Honestly I haven’t found a good answer yet, and have been pretty procrastinating to get my hands back on the stairs tool :blush:

In any case, like all Arch objects, the stair tool supports additions/subtractions. So you can start with a simple case and add more shapes to it. Ultimately that’s always what saves the day in FreeCAD, if an automatic tool fails, you can always revert to some manual modeling.

Hi, far from any modular approach… find difficult (as a newbie on Python) to implement the idea merging in the existing code… making it looks Frankenstein again… anyway proof of concept first.

Regardless the changes in code being experimenting are quite ‘ugly’, there is some slight progress:-

  1. Now, a new Property “Last Segment” is added to Stairs Object
  2. When a Stairs Object has Last Segment pointing to the preceding flight/landing, it succeeds the ‘Height’ of the preceding Stairs Objects
  3. When a Stairs Object has Step = 1 (previously not accepted), and Last Segment pointing to a StairObject, it create landing to ‘complete’ the last ‘step’
  4. So now, say, simply have 3 lines on plan, and make 3 Stairs Objects, ‘link’ them by 'Last Segment…
  5. The individual flight/landing’s length, height, width, steps, presence of steps… can be fine-tuned separately

Further ‘experiment’ later?

  1. Currently, ‘landing’ only works with 1 edge - the ‘new’ landing works exactly as ArchStairs generate ‘Step’ profile
  2. It seem not too difficult to make it accept more edges so the landing can ‘turn’ in direction
  3. Like what Revit seem to be doing, the ‘outline’ of landing generated by wireframe currently can generating a sketch then further control on the outline… hopefully
  4. The landing in this ‘mode’ is only a simply rectangular extrusion, no ‘connecting’ part to the lower or upper flight…so there is some gaps !

2 ‘versions’ of ArchStairs.py attached
version 3 - only have added stair landing depth, ‘return’ option etc.
version 4 - added ‘Last Segment’ property, ‘1-step’ stair generate landing based on line edge paved way for multi-segment landing…
Screenshot from 2018-07-02 09-55-29.png
Screenshot from 2018-07-02 09-59-57.png
Screenshot from 2018-07-02 10-11-53.png
ArchStairs(Paul_ Ver 4).py (32.8 KB)
ArchStairs (Paul_ Ver 3).py (28.6 KB)

@Paullee. Nice shot a programming. How long did it take you to be able to even figure what is going on and know where to tweak the code?

Looking good @paullee ! Great progresses. I’m happy someone is taking the dust off the stairs object. Also, if you feel better discarding the current code and reimplementing stuff from scratch, no problem! We’ll see what we do with it later on.

Hi all.

Don’t be mistaken by 1st screencapture below - it looks the landing is successfully constructed by the 3 red edges below? Just in this particular setting it looks as it works :blush:

Some geometries / codes issues being figured out…WIP… if someone like to look at / fix the mess created, please download :slight_smile:

(I think the approach to add different ‘portion’ of a staircase in a Stairs Object Addition has other ‘side effects’ / ‘problem’, anyway, let it later…)

BTW, looks the original ArchStair has bug that the ‘massive’ structure does not honour the ‘right’ / ‘centre’ alignment setting? Or I have mess up the codes? Will further check …

See anyone has comments or ideas on approach… Thanks.
Screenshot from 2018-07-05 06-48-37.png
Screenshot from 2018-07-05 06-48-26.png
Screenshot from 2018-07-05 05-55-33.png
Screenshot from 2018-07-05 05-55-28.png
ArchStairs(Paul_ Ver 5_ WIP).py (36.9 KB)

Hi, I originally try some macros to ‘automate’ some repeating keystroke / mouse actions I think around same time last year… not been trained as a programmer so never think of really doing some serious codes.

Python seems to be quite close to natural language (like BASIC?) (a programmer have better / accurate comments on this), macros… macros …then.. start longer ‘codes’ maybe end last year reading online ‘tutorials’ (messy though) …

Having said that, I think if have a gap, better get a lesson to start some ‘orthodox’ programming training - would save much time ‘trial and error’, better readability, comprehensiveness etc. I read my first ‘macros’ now… I do not understand it now… I would re-write it if have time.


BTW, it seem somebody like Yorik etc. should be kind of mastermind paving some development approach, objects to add / improve… and maybe then more peoples to work on one or a few particular ‘tasks’ (like Re-Bar etc.)… better synergy… and much easier for people like me do not have a full picture of Arch Module, not to mention FC, Python etc.

Start something?

Thanks.

Far from able to write something from scratch… if you don’t mind the original codes become a mess now :blush:

Would complete the landing first and see how to clean up the changes in codes better if it works afterall, and how ‘track-changes’ (MS Word term) works (sorry Gedit does not have this ‘feature’)… Just manage to open an account on GitHub, Kunda/Chrisb’s link should helps, when there is a gap.


BTW, I think the approach currently taken need a GUI like ‘drawing’ ArchWall ‘interactively’ - I simply have 0 idea / knowledge how it works… anyway, this is something much later.

Hi, now there is more fun… (My original attempt is just want to control tread depth / riser height which is not implemented here yet… :smiley: )

Figured out how to use DraftGeomUtils.findintersection w/ 4 points + not crossing each other (use infinite boolean…)

  1. Now a shape with a nos. of edges can generate a complex form of landing.
  2. With some ‘disciplines’ in drawing up edge(s) for staircases flight(s), it connect to the landing
  3. Found follow ‘underlying objects’ works-
  • Sketch
  • DWire
  • Line
  • Edge (Draft Downgrade from DWire…?)
  1. Align Option works for this ‘multi-edges’ landing
    (Haven’t figured out there is really an Align ‘bug’ for the Stairs Structure and ‘fix’ it yet…etc)

Any comments welcome … may further control width of ‘each turn’ of the landing?

  1. Really think a similar tool like drawing ArchWall should be done to ‘draw interactively’ the stairs flight + landing… by someone else capable :slight_smile:
  2. Maybe cleaning / tidying up / improving my ‘intrusion code’ in the ArchStair.py first?
  3. Turn the ‘automatically generated landing outline’ into a sketch for further fine-tuning?

Screenshot from 2018-07-06 02-39-31.png
Screenshot from 2018-07-06 02-54-18.png
Screenshot from 2018-07-06 03-01-59.png
Test_ ArchStairs_ code revision test_ 2d.fcstd (180 KB)
ArchStairs.py (37.2 KB)

This is becoming seriously cool! :sunglasses: