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

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
three_d
Posts: 26
Joined: Thu Aug 20, 2020 3:33 pm

Re: [PR] [0.18] [0.19_pre] Arch Stair - More Geometry Control? Profile Generator

Post by three_d »

Hi paullee, following your suggestions I tried to subtract the last riser from the "original solid" of the landing. In order to obtain this goal I used the boolean "cut" operation....and it seems to work very well.

I also slightly modified the step tread of the landing by adding new construction points (p5, p6) which vary according to the landing's "HalfTurn" settings.

Screenshot_24_05_21_halfturnleft.png
Screenshot_24_05_21_halfturnleft.png (223.32 KiB) Viewed 1987 times

Regarding the "modular approach", I tried to subtract the previous flight (Stairs001) from the geometry of the next landing (Stairs002), in this case, however, I used the "Subtractions" properties, it seems to work but with some limitations(e.g. the landing geometry could failed if tread thickness + landing thickness > up slab thickness )
so I am not very sure about this solution :?

Screenshot_24_05_21_modular.png
Screenshot_24_05_21_modular.png (251.97 KiB) Viewed 1987 times

Code: Select all

+ added line
- removed line
* changed line

					 .....

def makeStairs(baseobj=None,length=None,width=None,height=None,steps=None,name="Stairs"):

					.....

	for baseobjI in baseobj:
            
					.....

		if i > 1:
                
			additions.append(stairs[i])
                
			stairs[i].LastSegment = stairs[i-1]
                           

+			stairs[i].Subtractions = stairs[i-1]
		
		else:
                
			if len(stairs) > 1: # i.e. length >1, have a 'master' staircase created

                    	stairs[0].Base = stairs[1]
            
		i += 1
					.....

class _Stairs(ArchComponent.Component):

					.....

	def execute(self,obj):
		
		"constructs the shape of the stairs"

 	
		self.steps = []
 	      	self.risers = []

	        self.pseudosteps = []
 	       	self.structures = []

+ 	       	self.landings = []

		pl = obj.Placement
        	landings = 0 

	        base = None
       	      
					.....

+		if obj.Landings == "At center":
+            		if len(self.landings) > 0 and obj.RiserThickness.Value: 
+              			self.landings[0] = self.landings[0].cut(self.risers[-1])


*		if self.structures or self.steps or self.risers or self.landings:
*            		base = Part.makeCompound(self.structures + self.steps + self.risers + self.landings)

					.....

	def makeMultiEdgesLanding(self,obj,edges):
			
					.....
		
		if obj.StructureThickness.Value:
            
			landingFace = stepFace

			struct = landingFace.extrude(Vector(0,0,-abs(obj.StructureThickness.Value)))
			
            
+			self.landings.append(struct)

-	        if struct:

-	            self.structures.append(struct)

     
  	def makeStraightLanding(self,obj,edge,...):


					.....
	
		# step

		p1 = self.align(vBase,obj.Align,vWidth)
		
-		p1o = p1.add(Vector(0,0,-abs(obj.TreadThickness.Value)))

+		if (obj.Flight == "HalfTurnLeft"):
        
+	            p1 = p1.add(Vector(0,0,-abs(obj.TreadThickness.Value)))
+	            p2 = p1.add(vLength)
         
+	        elif (obj.Flight == "HalfTurnRight"):	

+	            p1 = p1.add(vNose).add(Vector(0,0,-abs(obj.TreadThickness.Value))) 
+	            p2 = p1.add(DraftVecUtils.neg(vNose)).add(vLength)
           
+        	else: #'Straight'

+	            p1 = p1.add(vNose).add(Vector(0,0,-abs(obj.TreadThickness.Value))) 
+	            p2 = p1.add(DraftVecUtils.neg(vNose)).add(vLength)
          
+        	p3 = p2.add(vWidth)
        	
+	        if (obj.Flight == "HalfTurnRight"):

+	            p4 = p3.add(DraftVecUtils.neg(vLength))
+	            p5 = p4.add(DraftVecUtils.scaleTo(vWidth,len))
           
+	        else: #'HalfTurnLeft'

+	            p4 = p3.add(DraftVecUtils.neg(vLength)).add(vNose)
+	            p5 = p4.sub(DraftVecUtils.scaleTo(vWidth,len)).add(DraftVecUtils.neg(vNose))
           
+	        p6 = p5.add(vNose)	
			
					.....	

		if callByMakeStraightStairsWithLanding:
			if obj.Flight == "HalfTurnLeft":

                		p1 = p1.add(-vWidth)
               			p2 = p2.add(-vWidth)

            	elif obj.Flight == "HalfTurnRight":

                	p3 = p3.add(vWidth)
                	p4 = p4.add(vWidth)

+                	p5 = p4.add(-vWidth)
+                	p6 = p5.add(vNose)


+		if (obj.Flight == "HalfTurnRight"):

+            		step = Part.Face(Part.makePolygon([p1,p2,p3,p4,p5,p6,p1]))
              
+        	elif (obj.Flight == "HalfTurnLeft"):

+            		step = Part.Face(Part.makePolygon([p1,p2,p3,p4,p6,p5,p1]))
            
+        	else: #"Straight"

            		step = Part.Face(Part.makePolygon([p1,p2,p3,p4,p1]))  
			
					.....

		# structure
	        lProfile = []
	        struct = None
        
+	        if obj.Flight in ["Straight","HalfTurnRight"]:
	            p1 = p1.add(DraftVecUtils.neg(vNose))
       
	        p2 = p1.add(Vector(0,0,-(abs(fHeight) - obj.TreadThickness.Value))) 
	        p3 = p1.add(vLength)
	        p4 = p3.add(Vector(0,0,-(abs(fHeight) - obj.TreadThickness.Value))) 


		if obj.Structure == "Massive":
	            if obj.StructureThickness.Value:

					.....

+			self.landings.append(struct)

 
					.....


-            	if struct:
-          		self.structures.append(struct)



	def makeStraightStairs(self,obj,edge,s1,s2,numberofsteps.....):


					.....

		# steps and risers
*	        for i in range(numberofsteps):
			p1 = vBasedAligned.add((Vector(vLength).multiply(i)).add(Vector(vHeight).multiply(i+1)))
            		p1 = p1.add(Vector(0,0,-abs(obj.TreadThickness.Value)))
			
            		r1 = p1
			
            		p1 = p1.add(vNose)
            		p2 = p1.add(DraftVecUtils.neg(vNose)).add(vLength)
            		p3 = p2.add(vWidth)
            		p4 = p3.add(DraftVecUtils.neg(vLength)).add(vNose)

            		step = Part.Face(Part.makePolygon([p1,p2,p3,p4,p1]))
		
*			if i < (numberofsteps-1) and obj.TreadThickness.Value:
                		step = step.extrude(Vector(0,0,abs(obj.TreadThickness.Value)))
                		self.steps.append(step)
            		else:
                		self.pseudosteps.append(step)

		 	r2 = r1.add(DraftVecUtils.neg(vHeight))

* 			if i == 0 and downstartstairs == "HorizontalCut":
  				r2 = r2.add(Vector(0,0,abs(obj.TreadThickness.Value)))			
  				r3 = r2.add(vWidth)
  				r4 = r3.add(vHeight)
* 			if i == 0 and downstartstairs == "HorizontalCut":
  			 	r4 = r4.add(Vector(0,0,-abs(obj.TreadThickness.Value)))
 		 	riser = Part.Face(Part.makePolygon([r1,r2,r3,r4,r1]))
			
			
			if obj.RiserThickness.Value:

     		        	riser = riser.extrude(vRiserThickness)	#Vector(0,100,0))

*                		self.risers.append(riser)
            
			else:

                		self.pseudosteps.append(riser)

					.....
ArchStairs[24_05_21].py
(72.44 KiB) Downloaded 95 times
ArchStairs[24_05_21].FCStd
(59.34 KiB) Downloaded 91 times
Test_ ArchStairs[ 24_05_21].FCStd
(169.73 KiB) Downloaded 89 times
paullee
Veteran
Posts: 5120
Joined: Wed May 04, 2016 3:58 pm

Re: [PR] [0.18-0.20_pre] Arch Stair - More Geometry Control? Profile Generator

Post by paullee »

three_d wrote: Mon May 24, 2021 6:06 pm I also slightly modified the step tread of the landing by adding new construction points (p5, p6) which vary according to the landing's "HalfTurn" settings.
...
Regarding the "modular approach", I tried to subtract the previous flight (Stairs001) from the geometry of the next landing (Stairs002), in this case, however, I used the "Subtractions" properties, it seems to work but with some limitations(e.g. the landing geometry could failed if tread thickness + landing thickness > up slab thickness )
so I am not very sure about this solution :?
...
Wow! Look gorgeous ! :D

It certainly looks much better! Can you elaborate or capture a screen about the 'subtraction case'? I hope to have a closer look soon after I attack some automatic placement feature.


Had briefly discussed with @yorik (wow realise it was almost 2 years ago) about how 'modular' it might be, sharing first idea below, probably should be revisited, and hopefully find more intuitive and flexible ways for use :)

Conceiving that each 'component' should be 'output' individually, so users can further 'post-processed' separately, e.g. addition or subtraction, ouputing 'profile' only to be further swept into other form, assigned with different materials...

Screenshot from 2021-05-25 08-14-10.png
Screenshot from 2021-05-25 08-14-10.png (28.27 KiB) Viewed 1951 times
Screenshot from 2021-05-25 08-14-58.png
Screenshot from 2021-05-25 08-14-58.png (46.73 KiB) Viewed 1951 times
User avatar
three_d
Posts: 26
Joined: Thu Aug 20, 2020 3:33 pm

Re: [PR] [0.18-0.20_pre] Arch Stair - More Geometry Control? Profile Generator

Post by three_d »

paullee wrote: Tue May 25, 2021 12:21 am It certainly looks much better! Can you elaborate or capture a screen about the 'subtraction case'? I hope to have a closer look soon after I attack some automatic placement feature.
Yes, of course, in the image below you can see a subtraction example between first flight and landing :)

Screenshot_25_05_21_subtractions.png
Screenshot_25_05_21_subtractions.png (264.66 KiB) Viewed 1885 times

paullee wrote: Tue May 25, 2021 12:21 am Had briefly discussed with @yorik (wow realise it was almost 2 years ago) about how 'modular' it might be, sharing first idea below, probably should be revisited, and hopefully find more intuitive and flexible ways for use :)
I definitely agree in having this modular approach, it seem much quicker and I also find interesting using the profile generator....I think these methods could be very useful.
paullee
Veteran
Posts: 5120
Joined: Wed May 04, 2016 3:58 pm

Re: [PR] [0.18-0.20_pre] Arch Stair - More Geometry Control? Profile Generator

Post by paullee »

Wiki of Arch_Stairs is largely not updated since 0.18_pre probably :lol:

Trying to update. Anyone would like to help, editing, proof-read, comment etc. ?
User avatar
Roy_043
Veteran
Posts: 8552
Joined: Thu Dec 27, 2018 12:28 pm

Re: [PR] [0.18-0.20_pre] Arch Stair - More Geometry Control? Profile Generator

Post by Roy_043 »

paullee wrote: Mon Jan 31, 2022 10:11 am Trying to update.
I have completed the Properties paragraph. Please check that. I have sometimes reworded the text from the tooltips a little.

I have to say I do not like some of the property names. "Connection Down Start Stairs" and "Connection End Stairs Up" could perhaps be simplified? And a property "Structure" inside the group "Structure" is a bit confusing. Also I do not understand why some enumeration values start with a lower case letter, and why some don't have spaces.
paullee
Veteran
Posts: 5120
Joined: Wed May 04, 2016 3:58 pm

Re: [PR] [0.18-0.20_pre] Arch Stair - More Geometry Control? Profile Generator

Post by paullee »

Roy_043 wrote: Wed Feb 09, 2022 8:06 pm I have completed the Properties paragraph. Please check that. I have sometimes reworded the text from the tooltips a little.

I have to say I do not like some of the property names. "Connection Down Start Stairs" and "Connection End Stairs Up" could perhaps be simplified? And a property "Structure" inside the group "Structure" is a bit confusing. Also I do not understand why some enumeration values start with a lower case letter, and why some don't have spaces.
Thanks, I noticed that update earlier :) Not sure what properties "Connection Down ..." do. May have another look later :)
paullee
Veteran
Posts: 5120
Joined: Wed May 04, 2016 3:58 pm

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

Post by paullee »

Cross-posting discussion in OSArch here -

BlenderBim Tutorial - Stairs & Storeys - Discussion Thread
Post Reply