<?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 Re: (SSGET &amp;quot;_X&amp;quot;) Rotate at angle in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ssget-quot-x-quot-rotate-at-angle/m-p/8802010#M88501</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@Anonymous&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
...
&lt;P&gt;&lt;FONT size="4"&gt; I'm still trying to do something like this, is it possible ?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff"&gt;&lt;EM&gt;&lt;FONT size="4"&gt;-If the number of vertices of my polyline is equal to or less than 5 rotate&amp;nbsp;&lt;STRONG&gt;"outside"&lt;/STRONG&gt;.&lt;/FONT&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff"&gt;&lt;EM&gt;&lt;FONT size="4"&gt;-If it is greater than 5 to rotate&amp;nbsp;&lt;STRONG&gt;"inside&lt;/STRONG&gt;".&lt;/FONT&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try this [&lt;EM&gt;minimally&lt;/EM&gt;&amp;nbsp; tested, but seems to work in your sample drawing]:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(defun C:ABP (/ ss n blk ins pathss path short CW); = Align Block(s) to Path(s)
  (if (setq ss (ssget '((0 . "INSERT"))))
    (repeat (setq n (sslength ss)); then
      (setq
        blk (vlax-ename-&amp;gt;vla-object (ssname ss (setq n (1- n))))
        ins (vlax-get blk 'InsertionPoint)
      ); setq
      (if (setq pathss (ssget "_C" (polar ins 0 1) (polar ins pi 1) '((0 . "*LINE"))))
        (progn ; then
          (setq
            path (ssname pathss 0)
            short (&amp;lt;= (cdr (assoc 90 (entget path))) 5)
            CW ; Polyline is clockwise [T or nil]
              (LM:ListClockwise-p
                (mapcar 'cdr ; point list of vertices
                  (vl-remove-if-not
                    '(lambda ( x ) (= (car x) 10))
                    (entget path)
                  ); ...remove...
                ); mapcar
              ); ...Clockwise... &amp;amp; CW
          ); setq
          (vla-put-Rotation blk
            (+
              (angle
                '(0 0 0)
                (vlax-curve-getFirstDeriv path
                  (vlax-curve-getParamAtPoint path
                    (vlax-curve-getClosestPointTo path ins)
                  ); ...getParam...
                ); ...FirstDeriv
              ); angle
              (if (or (and short CW) (and (not short) (not CW)))
                0 ; then -- path's direction
                pi ; else -- reverse
              ); if
            ); +
          ); ...put...
        ); progn
      ); if
    ); repeat
  ); if
  (princ)
); defun

;; List Clockwise-p  -  Lee Mac
;; Returns T if the point list is clockwise oriented
(defun LM:ListClockwise-p (lst)
  (minusp
    (apply '+
      (mapcar
        (function
          (lambda ( a b )
            (- (* (car b) (cadr a)) (* (car a) (cadr b)))
          )
        )
        lst (cons (last lst) lst)
      )
    )
  )
)&lt;/PRE&gt;
&lt;P&gt;It uses&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/569456"&gt;@Lee_Mac&lt;/a&gt; 's&amp;nbsp;clockwise-ness test [one of the more concise of many such tests out there for the Searching], from &lt;A href="https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polyline-clockwise-or-counter-clockwise/m-p/3167232/highlight/true#M299304" target="_blank" rel="noopener"&gt;&amp;gt;here&amp;lt;&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;[I didn't change the command name from before, but you may want to, to suit these more limited circumstances.]&lt;/P&gt;</description>
    <pubDate>Mon, 20 May 2019 13:28:38 GMT</pubDate>
    <dc:creator>Kent1Cooper</dc:creator>
    <dc:date>2019-05-20T13:28:38Z</dc:date>
    <item>
      <title>(SSGET "_X") Rotate at angle</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ssget-quot-x-quot-rotate-at-angle/m-p/8796439#M88485</link>
      <description>&lt;P&gt;&lt;FONT size="4"&gt;Hello guys,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="4"&gt;Is there a way with the &lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;(&lt;/FONT&gt;&lt;FONT color="#0000FF"&gt;SSGET&lt;/FONT&gt; "_&lt;FONT color="#FF00FF"&gt;X"&lt;/FONT&gt;&lt;FONT color="#FF0000"&gt;)&lt;/FONT&gt;&lt;/STRONG&gt; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;I rotate all my blocks in the (pline, line, arc ...) angle that the same is together.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ba.png" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/637413i13377E891DD33E53/image-size/large?v=v2&amp;amp;px=999" role="button" title="ba.png" alt="ba.png" /&gt;&lt;/span&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;I'll attach a .dwg file that will be easier to understand.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 16 May 2019 18:51:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ssget-quot-x-quot-rotate-at-angle/m-p/8796439#M88485</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-05-16T18:51:31Z</dc:date>
    </item>
    <item>
      <title>Re: (SSGET "_X") Rotate at angle</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ssget-quot-x-quot-rotate-at-angle/m-p/8796501#M88486</link>
      <description>&lt;P&gt;The problem I see is that the Blocks on &lt;EM&gt;one&lt;/EM&gt;&amp;nbsp; side of each (whatever they are -- roadways?) need their rotation to be in the direction the Polyline is running, but those on the &lt;EM&gt;other&lt;/EM&gt;&amp;nbsp; side need to be the&amp;nbsp;&lt;EM&gt;opposite&lt;/EM&gt;&amp;nbsp; direction.&amp;nbsp; Those on the "northeast" [if&amp;nbsp;north is up]&amp;nbsp;side of the longer route are at 140 degrees, but those on the "southwest" side are at 320 degrees, but the Polylines they lie on all run in the &lt;EM&gt;same&lt;/EM&gt;&amp;nbsp; direction [320].&amp;nbsp; Can you delineate a means whereby a routine could figure out which way to turn a given Block?&lt;/P&gt;</description>
      <pubDate>Thu, 16 May 2019 19:20:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ssget-quot-x-quot-rotate-at-angle/m-p/8796501#M88486</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2019-05-16T19:20:26Z</dc:date>
    </item>
    <item>
      <title>Re: (SSGET "_X") Rotate at angle</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ssget-quot-x-quot-rotate-at-angle/m-p/8796516#M88487</link>
      <description>&lt;P&gt;&lt;FONT size="4"&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;It makes no difference, of preference 140 degrees -&amp;nbsp;But if you stay always on the internal side of my pline it will be better!&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 16 May 2019 19:42:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ssget-quot-x-quot-rotate-at-angle/m-p/8796516#M88487</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-05-16T19:42:56Z</dc:date>
    </item>
    <item>
      <title>Re: (SSGET "_X") Rotate at angle</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ssget-quot-x-quot-rotate-at-angle/m-p/8796554#M88488</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@Anonymous&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;FONT size="4"&gt;.... &lt;SPAN&gt;It makes no difference.....&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just to confirm:&amp;nbsp; Does that mean this is an acceptable outcome, with half of the Block "inside" the route and half of them "outside"?&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="NoDifference.PNG" style="width: 308px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/637434i412E511BB4D575A7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="NoDifference.PNG" alt="NoDifference.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 16 May 2019 19:43:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ssget-quot-x-quot-rotate-at-angle/m-p/8796554#M88488</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2019-05-16T19:43:18Z</dc:date>
    </item>
    <item>
      <title>Re: (SSGET "_X") Rotate at angle</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ssget-quot-x-quot-rotate-at-angle/m-p/8796573#M88489</link>
      <description>&lt;P&gt;&lt;FONT size="4"&gt;YES!!!&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 16 May 2019 19:49:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ssget-quot-x-quot-rotate-at-angle/m-p/8796573#M88489</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-05-16T19:49:31Z</dc:date>
    </item>
    <item>
      <title>Re: (SSGET "_X") Rotate at angle</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ssget-quot-x-quot-rotate-at-angle/m-p/8797728#M88490</link>
      <description>&lt;P&gt;&lt;FONT size="4"&gt;Could not the blocks always stay inside?&lt;/FONT&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just to confirm:&amp;nbsp; Does that mean this is an acceptable outcome, with half of the Block "inside" the route and half of them "outside"?&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="NoDifference.PNG" style="width: 308px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/637434i412E511BB4D575A7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="NoDifference.PNG" alt="NoDifference.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT size="4"&gt;This result is already very good!&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2019 11:06:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ssget-quot-x-quot-rotate-at-angle/m-p/8797728#M88490</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-05-17T11:06:38Z</dc:date>
    </item>
    <item>
      <title>Re: (SSGET "_X") Rotate at angle</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ssget-quot-x-quot-rotate-at-angle/m-p/8798004#M88491</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;
&lt;PRE&gt;(defun C:ABP (/ ss n blk ins pathss path); = Align Block(s) to Path(s)
  (if (setq ss (ssget '((0 . "INSERT"))))
    (repeat (setq n (sslength ss)); then
      (setq
        blk (vlax-ename-&amp;gt;vla-object (ssname ss (setq n (1- n))))
        ins (vlax-get blk 'InsertionPoint)
      ); setq
      (if (setq pathss (ssget "_C" (polar ins 0 1) (polar ins pi 1) '((0 . "*LINE"))))
        (progn ; then
          (setq path (ssname pathss 0))
          (vla-put-Rotation blk
            (angle
              '(0 0 0)
              (vlax-curve-getFirstDeriv path
                (vlax-curve-getParamAtPoint path
                  (vlax-curve-getClosestPointTo path ins)
                ); ...getParam...
              ); ...FirstDeriv
            ); angle
          ); ...put...
        ); progn
      ); if
    ); repeat
  ); if
); defun&lt;/PRE&gt;
&lt;P&gt;I don't really like the Crossing-window selection of the path, because depending on the scale of things, it could find more than one path.&amp;nbsp; But when I used simply the insertion point as the pick point, it worked on only &lt;EM&gt;one&lt;/EM&gt; &amp;nbsp;Block in your sample drawing, and I couldn't figure out why.&amp;nbsp; It wasn't "seeing" the path for any Blocks but the one, even when I forced Block insertion points to ensure they were &lt;EM&gt;truly on&lt;/EM&gt;&amp;nbsp; the path.&amp;nbsp; I tried several variant approaches without success.&amp;nbsp; And it's not like somehow doing the first one spoiled anything for subsequent ones, because the one it worked on isn't the first or last one in the selection.&amp;nbsp; I even wondered whether the fact that the Block has an Alignment parameter could be the reason, but if so, it shouldn't have worked for any of them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In case anyone has any bright ideas as to what the problem could be, what I originally had in place of this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (if (setq pathss (ssget "_C" (polar ins 0 1) (polar ins pi 1) '((0 . "*LINE"))))&lt;/P&gt;
&lt;P&gt;was this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (if (setq pathss (ssget ins '((0 . "*LINE"))))&lt;/P&gt;
&lt;P&gt;which did the trick for&amp;nbsp;one Block [so it must have &lt;EM&gt;some&lt;/EM&gt;&amp;nbsp; kind of validity], but not for the rest.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I even tried adding the ":E" mode in, both before and after the 'ins', but got a too-many-arguments error.&amp;nbsp; And I tried that omitting the entity-type filter, intending to remove the Block from the resulting selection, but got a bad-point-argument error.&amp;nbsp; I guess I don't really get what the ":E" mode does, or how it relates to other arguments, and Help doesn't include any examples of its use.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By the way, for other kinds of path objects, you can replace that (ssget) filter list with:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; '((0 . "*LINE,CIRCLE,ARC,ELLIPSE,RAY"))&lt;/P&gt;
&lt;P&gt;[and, if necessary, do some checking later to avoid MLINEs, which such a selection would accept but which can't be aligned with using&amp;nbsp;(vlax-curve...)&amp;nbsp;methods].&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2019 13:07:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ssget-quot-x-quot-rotate-at-angle/m-p/8798004#M88491</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2019-05-17T13:07:44Z</dc:date>
    </item>
    <item>
      <title>Re: (SSGET "_X") Rotate at angle</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ssget-quot-x-quot-rotate-at-angle/m-p/8798052#M88492</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@Anonymous&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;FONT size="4"&gt;.... &lt;SPAN&gt;But if you stay always on the internal side of my pline it will be better!&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That's the challenging part.&amp;nbsp; There is no "internal side" of a Polyline that is not closed.&amp;nbsp; AutoLisp can find the Polyline that a Block's insertion point lies on, but it has no way of knowing that the Polyline has any relationship to any other Polyline in the drawing.&amp;nbsp; If, as I said before, you can spell out some way that a routine might be able to recognize which side of the Polyline is the "inside" of a "path" defined by that Polyline and another one, maybe an approach can be found to have the Block rotated so that it's on that "inside" of the path.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But one thing you could do, that's pretty quick:&amp;nbsp; Run the routine, and for the ones that come out on the "outside," they'll all be on the &lt;EM&gt;same&lt;/EM&gt;&amp;nbsp; side of their Polyline.&amp;nbsp; Use REVERSE on those Polylines, and run the routine again [you can do it on all Blocks again, or on just those Blocks].&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2019 13:22:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ssget-quot-x-quot-rotate-at-angle/m-p/8798052#M88492</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2019-05-17T13:22:14Z</dc:date>
    </item>
    <item>
      <title>Re: (SSGET "_X") Rotate at angle</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ssget-quot-x-quot-rotate-at-angle/m-p/8798118#M88493</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;....&amp;nbsp; I guess I don't really get what the ":E" mode does, or how it relates to other arguments, and Help doesn't include any examples of its use. ....&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/correct-syntax-of-ssget-with-e/m-p/6913964?collapse_discussion=true&amp;amp;filter=location&amp;amp;location=forum-board:130&amp;amp;q=%22_:E%22&amp;amp;search_type=thread" target="_blank" rel="noopener"&gt;&amp;gt;This&amp;lt;&lt;/A&gt; seems to confirm that, unfortunately,&amp;nbsp;":E" works only&amp;nbsp;in User-pick operation, not feed-in-a-point-variable use.&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2019 13:45:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ssget-quot-x-quot-rotate-at-angle/m-p/8798118#M88493</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2019-05-17T13:45:51Z</dc:date>
    </item>
    <item>
      <title>Re: (SSGET "_X") Rotate at angle</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ssget-quot-x-quot-rotate-at-angle/m-p/8798182#M88494</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;FONT size="2"&gt;....&amp;nbsp; There is no "internal side" of a Polyline that is not closed.&amp;nbsp; ....&amp;nbsp; If, as I said before, you can spell out some way that a routine might be able to recognize which side of the Polyline is the "inside" of a "path" defined by that Polyline and another one ....&lt;/FONT&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And now, looking back at Message 1, I see there's the possibility of &lt;EM&gt;Arcs&lt;/EM&gt;&amp;nbsp; as paths, so the expanded filter at the end of Message 7 should be incorporated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But&amp;nbsp;the "internal side" thing would require some additional consideration with a variety of possible path types.&amp;nbsp; An Arc &lt;EM&gt;does&lt;/EM&gt;&amp;nbsp; definitely have an "internal side," and unlike a Polyline, its drawn direction is always the same way [unless there are complications&amp;nbsp;such as a&amp;nbsp;&lt;EM&gt;from-underneath&lt;/EM&gt;&amp;nbsp; Coordinate System].&amp;nbsp; But if an Arc is one side of a "path" defined by two parallel/concentric Arcs, then the Blocks should go on the inside of one and the outside of the other.&amp;nbsp; The same question applies --&amp;nbsp;how is a routine to know whether a given Arc is the inner or the outer side of a path?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;[My suggestion involving REVERSE on Polylines would also work if the path objects are Lines or Splines, but can't be used on Arcs or Ellipses&amp;nbsp;-- I do have a &lt;A href="https://cadtips.cadalyst.com/object-properties/reverse-entity-direction" target="_blank" rel="noopener"&gt;routine to reverse their direction&lt;/A&gt;, but it involves changing&amp;nbsp;Arcs into Polylines and Ellipses into Splines, if that would be acceptable.&amp;nbsp; But even that won't reverse the direction of Xlines, if those are a possibility.]&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2019 14:21:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ssget-quot-x-quot-rotate-at-angle/m-p/8798182#M88494</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2019-05-17T14:21:48Z</dc:date>
    </item>
    <item>
      <title>Re: (SSGET "_X") Rotate at angle</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ssget-quot-x-quot-rotate-at-angle/m-p/8798424#M88495</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Try this:&lt;/P&gt;
&lt;PRE&gt;(defun C:ABP (/ ss n blk ins pathss path); = Align Block(s) to Path(s)
  (if (setq ss (ssget '((0 . "INSERT"))))
    (repeat (setq n (sslength ss)); then
      (setq
        blk (vlax-ename-&amp;gt;vla-object (ssname ss (setq n (1- n))))
        ins (vlax-get blk 'InsertionPoint)
      ); setq
      (if (setq pathss (ssget "_C" (polar ins 0 1) (polar ins pi 1) '((0 . "*LINE"))))
        (progn ; then
          (setq path (ssname pathss 0))
          (vla-put-Rotation blk
            (angle
              '(0 0 0)
              (vlax-curve-getFirstDeriv path
                (vlax-curve-getParamAtPoint path
                  (vlax-curve-getClosestPointTo path ins)
                ); ...getParam...
              ); ...FirstDeriv
            ); angle
          ); ...put...
        ); progn
      ); if
    ); repeat
  ); if
); defun&lt;/PRE&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;FONT size="4"&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt;&amp;nbsp;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="4"&gt;This is already perfect !!! I will mark as a solution because it will save me many hours of work.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2019 16:04:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ssget-quot-x-quot-rotate-at-angle/m-p/8798424#M88495</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-05-17T16:04:37Z</dc:date>
    </item>
    <item>
      <title>Re: (SSGET "_X") Rotate at angle</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ssget-quot-x-quot-rotate-at-angle/m-p/8798466#M88496</link>
      <description>&lt;P&gt;&lt;FONT size="4"&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt;&amp;nbsp; Most of my polylines are closed !!&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="4"&gt;So I can find the inner side?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;If there is such a possibility, how to do this?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;If the number of vertices of my polyline is equal to or less than 5 rotate&amp;nbsp;&lt;STRONG&gt;"outside"&lt;/STRONG&gt;.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;If it is greater than 5 to rotate &lt;SPAN&gt;&lt;STRONG&gt;"inside&lt;/STRONG&gt;".&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3"&gt;&lt;SPAN&gt;attached a .dwg with the example.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2019 16:19:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ssget-quot-x-quot-rotate-at-angle/m-p/8798466#M88496</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-05-17T16:19:21Z</dc:date>
    </item>
    <item>
      <title>Re: (SSGET "_X") Rotate at angle</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ssget-quot-x-quot-rotate-at-angle/m-p/8798550#M88497</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@Anonymous&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;FONT size="4"&gt;@... Most of my polylines are closed !!&amp;nbsp; &lt;/FONT&gt;&lt;FONT size="4"&gt;So I can find the inner side?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;If there is such a possibility, how to do this?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;If the number of vertices of my polyline is equal to or less than 5 rotate&amp;nbsp;&lt;STRONG&gt;"outside"&lt;/STRONG&gt;.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;If it is greater than 5 to rotate &lt;SPAN&gt;&lt;STRONG&gt;"inside&lt;/STRONG&gt;".&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;....&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Search this Forum for things like "polyline direction" and/or "clockwise vs. counterclockwise" and/or "inside or outside polyline" and the like -- there are many threads about the subject.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If one is drawn counterclockwise, Blocks defined as your example Block rotated to align in the drawn direction would be inside, and turned around in the opposite direction would be outside.&amp;nbsp; If one is drawn clockwise, the reverse.&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2019 16:54:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ssget-quot-x-quot-rotate-at-angle/m-p/8798550#M88497</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2019-05-17T16:54:15Z</dc:date>
    </item>
    <item>
      <title>Re: (SSGET "_X") Rotate at angle</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ssget-quot-x-quot-rotate-at-angle/m-p/8798676#M88498</link>
      <description>&lt;P&gt;&lt;FONT size="4"&gt;Thank you !!!! I'll search!&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2019 17:53:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ssget-quot-x-quot-rotate-at-angle/m-p/8798676#M88498</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-05-17T17:53:49Z</dc:date>
    </item>
    <item>
      <title>Re: (SSGET "_X") Rotate at angle</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ssget-quot-x-quot-rotate-at-angle/m-p/8799122#M88499</link>
      <description>&lt;P&gt;This is how I'd tackle it to be able to pick a side:&lt;/P&gt;
&lt;PRE&gt;(defun c:foo (/ _aap b bl l p p2 r s x)
  ;; RJP » 2019-05-17
  ;; Rotate a blocks to nearest polyline
  (defun _aap (e p / pa cp)
    (if	(setq pa (vlax-curve-getparamatpoint e p))
      (angle '(0 0 0) (vlax-curve-getfirstderiv e pa))
    )
  )
  (if (and (setq s (ssget ":L" '((0 . "insert,lwpolyline"))))
	   (foreach x (vl-remove-if 'listp (mapcar 'cadr (ssnamex s)))
	     (if (= "INSERT" (cdr (assoc 0 (entget x))))
	       (setq b (cons (vlax-ename-&amp;gt;vla-object x) b))
	       (setq l (cons x l))
	     )
	   )
	   b
	   l
      )
    (foreach lwp l
      (setq r nil)
      (foreach bl b
	(setq p (vlax-get bl 'insertionpoint))
	(cond ((equal 0 (distance p (setq p2 (vlax-curve-getclosestpointto lwp p))) 1e-3)
	       (setq r (cons bl r))
	       (vla-put-rotation bl (_aap lwp p2))
	       (vla-update bl)
	      )
	)
      )
      (cond (r
	     (redraw lwp 3)
	     (while (getpoint "\nPick a point to flip sides: ")
	       (foreach x r (vla-put-rotation x (+ pi (vla-get-rotation x))) (vla-update x))
	     )
	     (redraw lwp 4)
	    )
      )
    )
  )
  (princ)
)&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2019-05-17_16-29-10.gif" style="width: 828px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/637887i48BA2484C0325280/image-size/large?v=v2&amp;amp;px=999" role="button" title="2019-05-17_16-29-10.gif" alt="2019-05-17_16-29-10.gif" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2019 22:40:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ssget-quot-x-quot-rotate-at-angle/m-p/8799122#M88499</guid>
      <dc:creator>ronjonp</dc:creator>
      <dc:date>2019-05-17T22:40:14Z</dc:date>
    </item>
    <item>
      <title>Re: (SSGET "_X") Rotate at angle</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ssget-quot-x-quot-rotate-at-angle/m-p/8799906#M88500</link>
      <description>&lt;P&gt;&lt;FONT size="4"&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/593837"&gt;@ronjonp&lt;/a&gt;&amp;nbsp;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="4"&gt;Thank you very much, this will be very useful!&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;but I'm still trying to do something like this, is it possible ?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;&lt;FONT size="4"&gt;-If the number of vertices of my polyline is equal to or less than 5 rotate&amp;nbsp;&lt;STRONG&gt;"outside"&lt;/STRONG&gt;.&lt;/FONT&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;&lt;FONT size="4"&gt;-If it is greater than 5 to rotate&amp;nbsp;&lt;STRONG&gt;"inside&lt;/STRONG&gt;".&lt;/FONT&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 18 May 2019 20:33:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ssget-quot-x-quot-rotate-at-angle/m-p/8799906#M88500</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-05-18T20:33:20Z</dc:date>
    </item>
    <item>
      <title>Re: (SSGET "_X") Rotate at angle</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ssget-quot-x-quot-rotate-at-angle/m-p/8802010#M88501</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@Anonymous&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
...
&lt;P&gt;&lt;FONT size="4"&gt; I'm still trying to do something like this, is it possible ?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff"&gt;&lt;EM&gt;&lt;FONT size="4"&gt;-If the number of vertices of my polyline is equal to or less than 5 rotate&amp;nbsp;&lt;STRONG&gt;"outside"&lt;/STRONG&gt;.&lt;/FONT&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff"&gt;&lt;EM&gt;&lt;FONT size="4"&gt;-If it is greater than 5 to rotate&amp;nbsp;&lt;STRONG&gt;"inside&lt;/STRONG&gt;".&lt;/FONT&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try this [&lt;EM&gt;minimally&lt;/EM&gt;&amp;nbsp; tested, but seems to work in your sample drawing]:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(defun C:ABP (/ ss n blk ins pathss path short CW); = Align Block(s) to Path(s)
  (if (setq ss (ssget '((0 . "INSERT"))))
    (repeat (setq n (sslength ss)); then
      (setq
        blk (vlax-ename-&amp;gt;vla-object (ssname ss (setq n (1- n))))
        ins (vlax-get blk 'InsertionPoint)
      ); setq
      (if (setq pathss (ssget "_C" (polar ins 0 1) (polar ins pi 1) '((0 . "*LINE"))))
        (progn ; then
          (setq
            path (ssname pathss 0)
            short (&amp;lt;= (cdr (assoc 90 (entget path))) 5)
            CW ; Polyline is clockwise [T or nil]
              (LM:ListClockwise-p
                (mapcar 'cdr ; point list of vertices
                  (vl-remove-if-not
                    '(lambda ( x ) (= (car x) 10))
                    (entget path)
                  ); ...remove...
                ); mapcar
              ); ...Clockwise... &amp;amp; CW
          ); setq
          (vla-put-Rotation blk
            (+
              (angle
                '(0 0 0)
                (vlax-curve-getFirstDeriv path
                  (vlax-curve-getParamAtPoint path
                    (vlax-curve-getClosestPointTo path ins)
                  ); ...getParam...
                ); ...FirstDeriv
              ); angle
              (if (or (and short CW) (and (not short) (not CW)))
                0 ; then -- path's direction
                pi ; else -- reverse
              ); if
            ); +
          ); ...put...
        ); progn
      ); if
    ); repeat
  ); if
  (princ)
); defun

;; List Clockwise-p  -  Lee Mac
;; Returns T if the point list is clockwise oriented
(defun LM:ListClockwise-p (lst)
  (minusp
    (apply '+
      (mapcar
        (function
          (lambda ( a b )
            (- (* (car b) (cadr a)) (* (car a) (cadr b)))
          )
        )
        lst (cons (last lst) lst)
      )
    )
  )
)&lt;/PRE&gt;
&lt;P&gt;It uses&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/569456"&gt;@Lee_Mac&lt;/a&gt; 's&amp;nbsp;clockwise-ness test [one of the more concise of many such tests out there for the Searching], from &lt;A href="https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polyline-clockwise-or-counter-clockwise/m-p/3167232/highlight/true#M299304" target="_blank" rel="noopener"&gt;&amp;gt;here&amp;lt;&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;[I didn't change the command name from before, but you may want to, to suit these more limited circumstances.]&lt;/P&gt;</description>
      <pubDate>Mon, 20 May 2019 13:28:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ssget-quot-x-quot-rotate-at-angle/m-p/8802010#M88501</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2019-05-20T13:28:38Z</dc:date>
    </item>
    <item>
      <title>Re: (SSGET "_X") Rotate at angle</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ssget-quot-x-quot-rotate-at-angle/m-p/8804261#M88502</link>
      <description>&lt;P&gt;&lt;FONT size="4"&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt;&amp;nbsp;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="4"&gt;Thank you very very&amp;nbsp; much!!&amp;nbsp;This works well!&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2019 11:05:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/ssget-quot-x-quot-rotate-at-angle/m-p/8804261#M88502</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-05-21T11:05:50Z</dc:date>
    </item>
  </channel>
</rss>

