<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Sweeping a railing along a curved stairs and its twisting on me in AutoCAD Forum</title>
    <link>https://forums.autodesk.com/t5/autocad-forum/sweeping-a-railing-along-a-curved-stairs-and-its-twisting-on-me/m-p/12942527#M12168</link>
    <description>&lt;P&gt;Im trying to sweep a railing profile up a curved stair case, for a reason i cant figure out its twisting on me. My selections have been turning alignment off and making sure Twist Expression is at 0 and I use Basepoint. I attached the file so you can see what im talking about and then copied a test off to the side. If anyone could help me i would appreciate it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Paul&lt;/P&gt;</description>
    <pubDate>Tue, 06 Aug 2024 16:59:10 GMT</pubDate>
    <dc:creator>JK-CAD2</dc:creator>
    <dc:date>2024-08-06T16:59:10Z</dc:date>
    <item>
      <title>Sweeping a railing along a curved stairs and its twisting on me</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/sweeping-a-railing-along-a-curved-stairs-and-its-twisting-on-me/m-p/12942527#M12168</link>
      <description>&lt;P&gt;Im trying to sweep a railing profile up a curved stair case, for a reason i cant figure out its twisting on me. My selections have been turning alignment off and making sure Twist Expression is at 0 and I use Basepoint. I attached the file so you can see what im talking about and then copied a test off to the side. If anyone could help me i would appreciate it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Paul&lt;/P&gt;</description>
      <pubDate>Tue, 06 Aug 2024 16:59:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/sweeping-a-railing-along-a-curved-stairs-and-its-twisting-on-me/m-p/12942527#M12168</guid>
      <dc:creator>JK-CAD2</dc:creator>
      <dc:date>2024-08-06T16:59:10Z</dc:date>
    </item>
    <item>
      <title>Re: Sweeping a railing along a curved stairs and its twisting on me</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/sweeping-a-railing-along-a-curved-stairs-and-its-twisting-on-me/m-p/12942591#M12169</link>
      <description>&lt;P&gt;Would it make any difference if you defined the path as a HELIX rather than a SPLINE?&amp;nbsp; I imagine that would be more accurate as a path, anyway.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Aug 2024 17:24:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/sweeping-a-railing-along-a-curved-stairs-and-its-twisting-on-me/m-p/12942591#M12169</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2024-08-06T17:24:24Z</dc:date>
    </item>
    <item>
      <title>Re: Sweeping a railing along a curved stairs and its twisting on me</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/sweeping-a-railing-along-a-curved-stairs-and-its-twisting-on-me/m-p/12942595#M12170</link>
      <description>Thanks for the reply.&lt;BR /&gt;&lt;BR /&gt;i suppose not, but not sure how to do that.</description>
      <pubDate>Tue, 06 Aug 2024 17:25:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/sweeping-a-railing-along-a-curved-stairs-and-its-twisting-on-me/m-p/12942595#M12170</guid>
      <dc:creator>JK-CAD2</dc:creator>
      <dc:date>2024-08-06T17:25:25Z</dc:date>
    </item>
    <item>
      <title>Re: Sweeping a railing along a curved stairs and its twisting on me</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/sweeping-a-railing-along-a-curved-stairs-and-its-twisting-on-me/m-p/12942627#M12171</link>
      <description>&lt;P&gt;Helixes can be a little tricky to define, but first of all there would need to be a known center point.&amp;nbsp; I tried OSNAPping to the CENter of something to find such a place, but there are a whole passel of 'em.&amp;nbsp; Can you tie that down, as a start?&lt;/P&gt;</description>
      <pubDate>Tue, 06 Aug 2024 17:46:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/sweeping-a-railing-along-a-curved-stairs-and-its-twisting-on-me/m-p/12942627#M12171</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2024-08-06T17:46:54Z</dc:date>
    </item>
    <item>
      <title>Re: Sweeping a railing along a curved stairs and its twisting on me</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/sweeping-a-railing-along-a-curved-stairs-and-its-twisting-on-me/m-p/12942690#M12172</link>
      <description>&lt;P&gt;So i believe i developed the radius of the sections of rail.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Background history, this stair was scanned and we imported it into autocad, thats why the lines are not smooth and the same radiuses&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;see attached&lt;/P&gt;</description>
      <pubDate>Tue, 06 Aug 2024 18:21:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/sweeping-a-railing-along-a-curved-stairs-and-its-twisting-on-me/m-p/12942690#M12172</guid>
      <dc:creator>JK-CAD2</dc:creator>
      <dc:date>2024-08-06T18:21:16Z</dc:date>
    </item>
    <item>
      <title>Re: Sweeping a railing along a curved stairs and its twisting on me</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/sweeping-a-railing-along-a-curved-stairs-and-its-twisting-on-me/m-p/12943050#M12173</link>
      <description>&lt;P&gt;I wrote the attached vlisp program to give me a better feel for the curvature of a spline. It determines the instantaneous radius of curvature at a 100 points along a spline. In addition to numerical values the program will draw lines showing either lines from a point on the spline to the center of curvature for that point (e.g., short lines are small radii, flat sections long lines), or curvature (short lines indication near flat curvature).&amp;nbsp; The latter option requires a scale factor to aid visualization.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I ran the program on your spline wth the following results.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="leeminardi_0-1722982238748.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1395013iF6DD288CC7BBF8FC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="leeminardi_0-1722982238748.png" alt="leeminardi_0-1722982238748.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Note that the area circled in red is fairly flat and the spline area circled in green has the smallest radii.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;YOu may want to use the numerical values to determine an approximate radius to use.&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(defun C:SplineCurvatue (/ path inc n osm par der1 der2 curva p perp normv p2 sf
	       curveType ans)
; = Degree Of Curvature - Lines
; Creates curvature lines or radius-of-curvature lines
; normal to a spline.
; LRM 8/18/2022 edited to place curvature vectors outside  
  (setq
    path (car (entsel))
    inc	 (/ (vlax-curve-getEndParam path) 100)
    n	 0
    osm	 (getvar 'osmode)
  )
  (setvar 'osmode 0)
  (setvar "cmdecho" 0)
  (initget "y n")
  (setq ans (getkword  "Do you want radius-of-curvature instead of curvature? [y/n] &amp;lt;n&amp;gt;: "))
	(if (= ans "y")
	   (setq curveType 1)
	   (setq curveType 2
		 sf	   (getdist "Enter scale factor.")
	   )
	)
  (repeat 100
    (setq par (* inc n))
    (setq der1 (vlax-curve-getfirstDeriv path par)
	  der2 (vlax-curve-getSecondDeriv path par)
    )
    ; calculate curvature at point par
    (setq d (distance '(0 0 0) (cross der1 der2)))
    (if	(&amp;gt; (abs d) 1.0e-15)
      (progn
	(setq curva (/ (expt (distance '(0 0 0) der1) 3) d))
	(if (= curveType 2)
	    (setq curva (* -1. (* sf (/ 1. curva))))
	  )
	(princ "\n") (princ n)
	(princ "   curvature = ") (princ curva)
	(setq p	    (vlax-curve-getPointAtParam path par)
	      perp  (unitv (cross der1 (cross der2 der1)))
	      normv (mapcar '* perp (list curva curva curva))
	      p2    (mapcar '+ p normv)
	)
	(command "_.line" p p2 "")
      )					; end progn
    )
    (setq n (1+ n))
  )
  (setvar 'osmode osm)
  (setvar "cmdecho" 1)
  (princ)
)


  ;;; Compute the cross product of 2 vectors a and b
(defun cross (a b / crs)
  (setq	crs (list
	      (- (* (nth 1 a) (nth 2 b))
		 (* (nth 1 b) (nth 2 a))
	      )
	      (- (* (nth 0 b) (nth 2 a))
		 (* (nth 0 a) (nth 2 b))
	      )
	      (- (* (nth 0 a) (nth 1 b))
		 (* (nth 0 b) (nth 1 a))
	      )
	    )				;end list
  )					;end setq c
)					;end cross
  (defun unitV ( v / d)
  (setq d (distance '(0 0 0) v)
	d (mapcar '/ v (list d d d))))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;On a related note,&amp;nbsp; I have found that I would prefer to use loft rather than sweep for 2D shapes swept along a spline.&amp;nbsp; Loft can provide better local control of twist.&amp;nbsp; The following program is a work-in-progress and not ready for prime time but you may find it helpful.&lt;/P&gt;&lt;P&gt;Begin by defining a block with the profile (a polyline) you would like to sweep.&amp;nbsp; Working in world coordinates make sure that the Z axis is perpendicular to the plane of th polyline.&lt;/P&gt;&lt;P&gt;Use the program to position multiple copies of the block along the spline.&amp;nbsp; You can modify the twist of individual sections by setting the UVS to OBject. Then use the standard 2D rotate command to adjust the twist for that section.&amp;nbsp; When you have the sections twisted as desirered explode all the section and use the loft command.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's the results I got bor a modified section of your railing.&amp;nbsp; I had to simplify the top of the section to get results.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="leeminardi_1-1722982990915.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1395017i83A1B9BAC4F6D094/image-size/medium?v=v2&amp;amp;px=400" role="button" title="leeminardi_1-1722982990915.png" alt="leeminardi_1-1722982990915.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(defun C:test (/ nsec blockname twist tottwist path inc n osm par der1
	 der2 p p1 p2 vy vz vx p3)
	       ;  draft version
;  Adds blocks along a spline.  The user specifies the number of blocks and
; the total amount of twist over the length of the spline.   The Z axis of the block
; is tangent to the spline.  
; LRM 5/1/2023 revised 6/4/2024  
(command "ucs" "w")
(setvar 'osmode 0)
(setq nsec (getint "\nEnter number of sections: "))
(setq nsec (- nsec 1))  
(setq blockname (getstring "\nEnter block name: "))
(setq twist (getreal "\nEnter start twist angle: "))
(setq tottwist (getreal "\nENter total twist start to end: "))  
(setq
  path (car (entsel))
  inc  (/ (vlax-curve-getEndParam path) nsec)
  n    0
  osm  (getvar 'osmode)
)
(setvar "cmdecho" 0)
(repeat	(+ nsec 1)
  (setq par (* inc n))
  (setq	der1 (vlax-curve-getfirstDeriv path par)
	der2 (vlax-curve-getSecondDeriv path par)
	p    (vlax-curve-getPointAtParam path par)
  )
  (setq p1 (mapcar '+ p (unitv (cross der1 der2))))
  (setq p2 (mapcar '+ p (unitv der1)))
  (setq vy (unitv (mapcar '- p1 p)))
  (setq vz (unitv (mapcar '- p2 p)))
  (setq vx (unitv (cross vy vz)))
  (setq p3 (mapcar '- p vx))
(command "_point" "_non" p)
(command "_point" "_non" p2)
(command "_point" "_non" p3)
  (command "-insert" blockname '(0 0 0) 1 1 0)
  (command "_align" "last" "" '(0 0 0) p '(1 0 0) p1 '(0 0 -1) p2 "n")
  (if (&amp;gt; (abs twist) 0.00001)
   (command "rotate3d" "last" "" "2" p p2 twist)
  )
  (setq twist (- twist (/ tottwist nsec)))
  (setq n (1+ n))
)					; end repeat
(setvar 'osmode osm)
(setvar "cmdecho" 1)
(princ)
)

  ;;; Compute the cross product of 2 vectors a and b
(defun cross (a b / crs)
  (setq	crs (list
	      (- (* (nth 1 a) (nth 2 b))
		 (* (nth 1 b) (nth 2 a))
	      )
	      (- (* (nth 0 b) (nth 2 a))
		 (* (nth 0 a) (nth 2 b))
	      )
	      (- (* (nth 0 a) (nth 1 b))
		 (* (nth 0 b) (nth 1 a))
	      )
	    )				;end list
  )					;end setq c
)					;end cross
(defun unitV (v / d)
  (setq	d (distance '(0 0 0) v)
	d (mapcar '/ v (list d d d))
  )
)
&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Aug 2024 22:24:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/sweeping-a-railing-along-a-curved-stairs-and-its-twisting-on-me/m-p/12943050#M12173</guid>
      <dc:creator>leeminardi</dc:creator>
      <dc:date>2024-08-06T22:24:13Z</dc:date>
    </item>
    <item>
      <title>Re: Sweeping a railing along a curved stairs and its twisting on me</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/sweeping-a-railing-along-a-curved-stairs-and-its-twisting-on-me/m-p/12944079#M12174</link>
      <description>&lt;P&gt;in the attached in top view a 3P circle fits the inner radius of the step.&lt;/P&gt;&lt;P&gt;QSELECT surfaces of the steps and delete leaving the regions which are the tops of the steps extruded down to solids&lt;/P&gt;&lt;P&gt;as in one step shown.&amp;nbsp; UNION together for one solid.&amp;nbsp; The bottom sloping surface I did not work with.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if you extruce the circle down and subtract from the step it makes a nice smooth cylindrical inner surface on the step solid.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;a helix path for the railing will now be circular based on the circle radius and everything should fit together.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;appears you have adequate data to redraw the steps.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Aug 2024 10:44:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/sweeping-a-railing-along-a-curved-stairs-and-its-twisting-on-me/m-p/12944079#M12174</guid>
      <dc:creator>parkr4st</dc:creator>
      <dc:date>2024-08-07T10:44:24Z</dc:date>
    </item>
    <item>
      <title>Re: Sweeping a railing along a curved stairs and its twisting on me</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/sweeping-a-railing-along-a-curved-stairs-and-its-twisting-on-me/m-p/12944325#M12175</link>
      <description>Great thank you for the deep dive into the issue, alot to unpack here but it looks like this will work and will give it a go. thanks for your input!</description>
      <pubDate>Wed, 07 Aug 2024 12:53:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/sweeping-a-railing-along-a-curved-stairs-and-its-twisting-on-me/m-p/12944325#M12175</guid>
      <dc:creator>JK-CAD2</dc:creator>
      <dc:date>2024-08-07T12:53:52Z</dc:date>
    </item>
  </channel>
</rss>

