<?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: LISP INSERT ARW in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-insert-arw/m-p/13381132#M1928</link>
    <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/10577275"&gt;@smallƑish&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maybe this:&lt;/P&gt;&lt;P&gt;if you define your pipe block to be dynamic change in one direction (length) and you keep the insertion point of the two to form the intersection, then this can be done very easily.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Moshe&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 20 Mar 2025 10:26:44 GMT</pubDate>
    <dc:creator>Moshe-A</dc:creator>
    <dc:date>2025-03-20T10:26:44Z</dc:date>
    <item>
      <title>LISP INSERT ARW</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-insert-arw/m-p/13373543#M1920</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Need help to fic the code, Just insert "D_ARW" Block in each Mline midle.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="lisp"&gt;(defun c:IN_ARW (/ mline-list mline start-point end-point ARW-block mid-point i)
  (setq mline-list (ssget '((0 . "MLINE"))))
  (setq ARW-block "D_ARW") ; Block name

  (if mline-list
    (progn
      (setq i 0)
      (repeat (sslength mline-list)
        (setq mline (ssname mline-list i))
        (setq start-point (vlax-curve-getStartPoint mline))
        (setq end-point (vlax-curve-getEndPoint mline))
        
        (setq mid-point (list (/ (+ (car start-point) (car end-point)) 2.0)
                              (/ (+ (cadr start-point) (cadr end-point)) 2.0)))
        
        (command "_.INSERT" ARW-block mid-point 1 1 0) ; Insert block with correct rotation
        (setq i (1+ i)) ; Increment index
      )
    )
  )
  (princ)
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 16 Mar 2025 09:12:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-insert-arw/m-p/13373543#M1920</guid>
      <dc:creator>smallƑish</dc:creator>
      <dc:date>2025-03-16T09:12:11Z</dc:date>
    </item>
    <item>
      <title>Re: LISP INSERT ARW</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-insert-arw/m-p/13373583#M1921</link>
      <description>&lt;P&gt;If your MLINEs are really just those single-segment types, you can use something line this:&lt;/P&gt;
&lt;LI-CODE lang="lisp"&gt;(defun c:IN_ARW (/ mline-list mline start-point end-point ARW-block mid-point i coords)
  (setq mline-list (ssget '((0 . "MLINE"))))
  (setq ARW-block "D_ARW") ; Block name

  (if mline-list
    (progn
      (setq i 0)
      (repeat (sslength mline-list)
        (setq mline (ssname mline-list i))
        (setq coords (vlax-safearray-&amp;gt;list (vlax-variant-value (vla-get-coordinates (vlax-ename-&amp;gt;vla-object mline)))))
        ;(setq start-point (vlax-curve-getStartPoint mline))
        ;(setq end-point (vlax-curve-getEndPoint mline))
        (setq start-point (list (nth 0 coords) (nth 1 coords))) ; 2D
        (setq end-point (list (nth 3 coords) (nth 4 coords)))
        (setq mid-point (list (/ (+ (car start-point) (car end-point)) 2.0)
                              (/ (+ (cadr start-point) (cadr end-point)) 2.0)))
        
        (command "_.INSERT" ARW-block mid-point 1 1 (angtos (angle start-point end-point))) ; Insert block with correct rotation
        (setq i (1+ i)) ; Increment index
      )
    )
  )
  (princ)
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Vladimir Michl, &lt;A href="http://www.arkance.world" target="_blank"&gt;www.arkance.world&lt;/A&gt;&amp;nbsp; -&amp;nbsp; &lt;A href="http://www.cadforum.cz" target="_blank"&gt;www.cadforum.cz&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 16 Mar 2025 10:18:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-insert-arw/m-p/13373583#M1921</guid>
      <dc:creator>vladimir_michl</dc:creator>
      <dc:date>2025-03-16T10:18:24Z</dc:date>
    </item>
    <item>
      <title>Re: LISP INSERT ARW</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-insert-arw/m-p/13373677#M1922</link>
      <description>&lt;P&gt;Thank you so much&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 16 Mar 2025 13:10:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-insert-arw/m-p/13373677#M1922</guid>
      <dc:creator>smallƑish</dc:creator>
      <dc:date>2025-03-16T13:10:02Z</dc:date>
    </item>
    <item>
      <title>Re: LISP INSERT ARW</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-insert-arw/m-p/13373789#M1923</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/10577275"&gt;@smallƑish&lt;/a&gt;&amp;nbsp;hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i see you are fast catching AutoLISP and this is very nice (as &lt;SPAN&gt;president&lt;/SPAN&gt; Trump saids&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;)&lt;/P&gt;&lt;P&gt;you declared all variables as local and this is very good&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;two things i want to enlighten:&lt;/P&gt;&lt;P&gt;the first, when using (command) function be aware the user has running object snap, this may interfere with your lisp resulting unwanted outcome. in this case if user has endpoint running, your block would be inserted at the close endpoint of mline. to overcome this add a "None" osnap before the point arguments&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(command "._insert" ARW-BLOCK &lt;FONT color="#0000FF"&gt;"_none"&lt;/FONT&gt; mid-point 1 1 0)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;at start disable command echoing =&amp;gt; (setvar "cmdecho" 0)&lt;/P&gt;&lt;P&gt;next invoke (command "._undo" "_begin")&lt;/P&gt;&lt;P&gt;before exist (command "._undo" "_end")&lt;/P&gt;&lt;P&gt;at exist (setvar "cmdecho" 1)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the undo calls enable the user to undo the lisp work with one U&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;second things&lt;/P&gt;&lt;P&gt;is finding the middle of two points:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;what you did is &lt;SPAN&gt;perfectly&lt;/SPAN&gt; all right (for &lt;SPAN&gt;beginner&lt;/SPAN&gt;) but you want to advance - yes?!&lt;/P&gt;&lt;P&gt;so here is a nice function called (midpt) using the&amp;nbsp;&lt;SPAN&gt;magnificent (mapcar) (lambda) functions&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;the idea here is the same as you did, addition two points divided by 2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;this works if points are 2d or 3d.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;enjoy&lt;/P&gt;&lt;P&gt;Moshe&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="lisp"&gt;(defun midpt (p0 p1 / x0 x1)
 (mapcar
   '(lambda (x0 x1)
      (/ (+ x0 x1) 2)
    )
  p0 p1 
 )
); midpt&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 16 Mar 2025 15:39:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-insert-arw/m-p/13373789#M1923</guid>
      <dc:creator>Moshe-A</dc:creator>
      <dc:date>2025-03-16T15:39:40Z</dc:date>
    </item>
    <item>
      <title>Re: LISP INSERT ARW</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-insert-arw/m-p/13373914#M1924</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/52747"&gt;@Moshe-A&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much for your advice, which I consider as guidance from a godfather. "None" OSNAP—I was looking for that, and you spotted it immediately! Also, all the additional knowledge is greatly appreciated. Thanks again!&lt;/P&gt;</description>
      <pubDate>Sun, 16 Mar 2025 18:35:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-insert-arw/m-p/13373914#M1924</guid>
      <dc:creator>smallƑish</dc:creator>
      <dc:date>2025-03-16T18:35:08Z</dc:date>
    </item>
    <item>
      <title>Re: LISP INSERT ARW</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-insert-arw/m-p/13374030#M1925</link>
      <description>&lt;P&gt;A couple more examples,&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(setq mp (mapcar '* (mapcar '+ p1 p3) '(0.5 0.5)))
(setq mp (mapcar '/ (mapcar '+ (vlax-curve-getStartPoint lin) (vlax-curve-getEndPoint lin)) '(2 2 2)))&lt;/LI-CODE&gt;&lt;P&gt;For a pline with multi segments the mid point can be found by taking the length of the Pline and divide by 2 then use .&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(setq mp (vlax-curve-getpointatdist obj dist))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 16 Mar 2025 21:18:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-insert-arw/m-p/13374030#M1925</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2025-03-16T21:18:44Z</dc:date>
    </item>
    <item>
      <title>Re: LISP INSERT ARW</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-insert-arw/m-p/13381041#M1926</link>
      <description>&lt;P&gt;how can we make the insertion on a block . instead of mline ?&lt;/P&gt;&lt;P&gt;sample file attached.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Mar 2025 09:40:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-insert-arw/m-p/13381041#M1926</guid>
      <dc:creator>smallƑish</dc:creator>
      <dc:date>2025-03-20T09:40:12Z</dc:date>
    </item>
    <item>
      <title>Re: LISP INSERT ARW</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-insert-arw/m-p/13381099#M1927</link>
      <description>&lt;P&gt;This will be quite difficult, especially with the "dynamic" nature of dynamic blocks. Have you considered including the symbol directly in your block? Then it can behave dynamically, staying in the middle even after changing the segment length.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Vladimir Michl, &lt;A href="http://www.arkance.world" target="_blank"&gt;www.arkance.world&lt;/A&gt;&amp;nbsp; -&amp;nbsp; &lt;A href="http://www.cadforum.cz" target="_blank"&gt;www.cadforum.cz&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Mar 2025 10:12:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-insert-arw/m-p/13381099#M1927</guid>
      <dc:creator>vladimir_michl</dc:creator>
      <dc:date>2025-03-20T10:12:30Z</dc:date>
    </item>
    <item>
      <title>Re: LISP INSERT ARW</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-insert-arw/m-p/13381132#M1928</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/10577275"&gt;@smallƑish&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maybe this:&lt;/P&gt;&lt;P&gt;if you define your pipe block to be dynamic change in one direction (length) and you keep the insertion point of the two to form the intersection, then this can be done very easily.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Moshe&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Mar 2025 10:26:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-insert-arw/m-p/13381132#M1928</guid>
      <dc:creator>Moshe-A</dc:creator>
      <dc:date>2025-03-20T10:26:44Z</dc:date>
    </item>
    <item>
      <title>Re: LISP INSERT ARW</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-insert-arw/m-p/13382173#M1929</link>
      <description>&lt;P&gt;Can that possible to explode the block and pick the middle point then save the mid point data. then undo all and insert arow on the stored point?&amp;nbsp;&lt;/P&gt;&lt;P&gt;looks like crazy thoughts, but still feel a door is open that way.&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":face_with_rolling_eyes:"&gt;🙄&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Mar 2025 19:48:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-insert-arw/m-p/13382173#M1929</guid>
      <dc:creator>smallƑish</dc:creator>
      <dc:date>2025-03-20T19:48:59Z</dc:date>
    </item>
    <item>
      <title>Re: LISP INSERT ARW</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-insert-arw/m-p/13382942#M1930</link>
      <description>&lt;P&gt;How about this? Using just dynamic properties - the symbol stays always centered and it is a part of the block. You may want to scale it up a little.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Vladimir Michl, &lt;A href="http://www.arkance.world" target="_blank"&gt;www.arkance.world&lt;/A&gt;&amp;nbsp; -&amp;nbsp; &lt;A href="http://www.cadforum.cz" target="_blank"&gt;www.cadforum.cz&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Mar 2025 07:38:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-insert-arw/m-p/13382942#M1930</guid>
      <dc:creator>vladimir_michl</dc:creator>
      <dc:date>2025-03-21T07:38:52Z</dc:date>
    </item>
  </channel>
</rss>

