<?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 command to determine the insertion point of a block in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-command-to-determine-the-insertion-point-of-a-block/m-p/12022001#M29133</link>
    <description>&lt;P&gt;Hi Pedean&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Support Bars are the magenta lines on the attached image, The chair heights is the block I want to modify to get inserted at the end of the support lines. I'd been trying for a while but no luck. any help will be greatly appreciated&lt;/P&gt;</description>
    <pubDate>Fri, 09 Jun 2023 05:54:47 GMT</pubDate>
    <dc:creator>isrsol702</dc:creator>
    <dc:date>2023-06-09T05:54:47Z</dc:date>
    <item>
      <title>Lisp command to determine the insertion point of a block</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-command-to-determine-the-insertion-point-of-a-block/m-p/12005059#M29126</link>
      <description>&lt;P&gt;I have this lips program that will insert a couple of blocks called Chair and Chair2 but it will always insert it in the middle of the support lines, I need it to insert the block at the end of the support lines. what can I do to change this setting?&amp;nbsp; here is a copy of the lisp program I'm using, any help will be greatly appreciated&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(defun c:drawsup ()&lt;/P&gt;&lt;P&gt;(setvar "osmode" 0)&lt;BR /&gt;(setq ss_tendon nil) ;INITIALIZE TENDON SELECTION SET&lt;BR /&gt;(setq nc 0) ;INITIALIZE NUMBER OF CHAIRS&lt;BR /&gt;(setvar "cmdecho" 0)&lt;BR /&gt;(setvar "attdia" 0)&lt;BR /&gt;(setq scarl '(("1/8" "~2") ("1/4" "~4") ("3/8" "~6") ("1/2" "~8")&lt;BR /&gt;("5/8" "~0") ("3/4" "~w") ("7/8" "~r"))&lt;BR /&gt;)&lt;BR /&gt;;SAVE CURRENT OSNAP SETTINGS&lt;BR /&gt;(setq omo (getvar "OSMODE"))&lt;BR /&gt;(setvar "OSMODE" 0)&lt;BR /&gt;(setq bsup_exist 'N) ;FLAG FOR EXISTING BEGINNING SUPPORT&lt;BR /&gt;(setq esup_exist 'N) ;FLAG FOR EXISTING ENDING SUPPORT&lt;BR /&gt;&lt;BR /&gt;(setq maxspa (getdist "Enter maximum support bar spacing [48\"]: "))&lt;BR /&gt;(if (= maxspa nil) (setq maxspa 48))&lt;BR /&gt;(setq a1 "100")&lt;BR /&gt;(while (not (or (&amp;lt; (atoi a1) 50) (= (strcase a1) "H")))&lt;BR /&gt;(setq a1 (getstring "\nEnter N value (L/N) to locate inflection point, 0 for simple parabola [10]: "))&lt;BR /&gt;(if (= a1 "") (setq a1 "10"))&lt;BR /&gt;)&lt;BR /&gt;(setq a1 (atof a1))&lt;BR /&gt;(if (/= a1 0.0)&lt;BR /&gt;(setq a1 (/ 1.0 a1))&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;;USER INPUT TO DETERMINE SUPPORT METHOD AT LOWPOINT&lt;BR /&gt;(initget 1 "c C s S")&lt;BR /&gt;(setq lpmethod (getkword "Use chairs[C] or rebar supports[S] at cgs\' lower than 1-1/2\": "))&lt;BR /&gt;(initget 1 "u U b B")&lt;BR /&gt;(setq t_layer (getkword "Enter U for Uniform or B for Banded tendon supports: "))&lt;BR /&gt;(if (= (strcase t_layer) "U")&lt;BR /&gt;(setq t_layer "UNIFORM")&lt;BR /&gt;(setq t_layer "BAND")&lt;BR /&gt;)&lt;BR /&gt;(command "layer" "T" t_layer "") ;THAW AFFECTED LAYER&lt;BR /&gt;(setq continue "Y")&lt;BR /&gt;(while (= (strcase continue) "Y")&lt;BR /&gt;&lt;BR /&gt;;DRAW FIRST SUPPORT LINE AT HIGHPOINT (OR GET POINTS IF LINE EXISTS)&lt;BR /&gt;(setq p1 (getpoint "Select both endpoints of uniform support at first highpoint: "))&lt;BR /&gt;(setq p2 (getpoint))&lt;BR /&gt;(terpri)&lt;BR /&gt;(if (= (getvar "orthomode") 1) ;MAKE P2 ORTHO W/ RESPECT TO P1 IF ORTHOMODE IS ON&lt;BR /&gt;(if (&amp;lt; (abs (- (car p1 ) (car p2))) (abs (- (cadr p1 ) (cadr p2))))&lt;BR /&gt;(setq p2 (list (car p1) (cadr p2)))&lt;BR /&gt;(setq p2 (list (car p2) (cadr p1)))&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;(if (&amp;lt; (cadr p2)(cadr p1)) ;SORT P1 &amp;amp; P2 W/ RESPECT TO Y&lt;BR /&gt;(progn&lt;BR /&gt;(setq p p1)&lt;BR /&gt;(setq p1 p2)&lt;BR /&gt;(setq p2 p)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;(setq ss_tendon (ssget "F" (list p1 p2) '((-4 . "&amp;lt;AND")(-4 . "&amp;lt;OR")(0 . "POLYLINE")(0 . "LWPOLYLINE")(-4 . "OR&amp;gt;")&lt;BR /&gt;(-4 . "&amp;lt;OR")(8 . "UNIFORM")(8 . "BAND")(-4 . "OR&amp;gt;")(-4 . "AND&amp;gt;"))))&lt;BR /&gt;(command "layer" "T" (strcat t_layer "_sup") "")&lt;BR /&gt;(setvar "CLAYER" (strcat t_layer "_sup"))&lt;BR /&gt;(if (ssget "F" (list p1 p2) '((-4 . "&amp;lt;AND")(-4 . "&amp;lt;OR")(0 . "POLYLINE")(0 . "LWPOLYLINE")(-4 . "OR&amp;gt;")&lt;BR /&gt;(-4 . "&amp;lt;OR")(8 . "UNIFORM_SUP")(8 . "BAND_SUP")(-4 . "OR&amp;gt;")(-4 . "AND&amp;gt;"))) ;DON"T DRAW LINE IF ALREADY EXISTS&lt;BR /&gt;(setq bsup_exist 'Y)&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;(setq hp1 (getdist "Enter first highpoint cgs in inches: "))&lt;BR /&gt;(setq lp (getdist "Enter lowpoint cgs in inches if required, else return: "))&lt;/P&gt;&lt;P&gt;;GET SS OF TENDONS INTERSECTING SUPPORT LINE&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;(if (/= ss_tendon nil)&lt;BR /&gt;(setq nc (tend_cnt ss_tendon p1 p2 ))&lt;BR /&gt;(progn&lt;BR /&gt;(alert "NO TENDONS FOUND ON THE UNIFORM OR BAND LAYERS - PROGRAM CANCELED")&lt;BR /&gt;(exit)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;;DETERMINE CHAIR QUANTITY&lt;BR /&gt;(setq nc (strcat "(" (itoa nc) ")"))&lt;/P&gt;&lt;P&gt;(setq p3 (getpoint "Select both endpoints of uniform support at second highpoint: "))&lt;BR /&gt;(setq p4 (getpoint))&lt;BR /&gt;(terpri)&lt;BR /&gt;(if (= (getvar "orthomode") 1) ;MAKE P4 ORTHO W/ RESPECT TO P3 IF ORTHOMODE IS ON&lt;BR /&gt;(if (&amp;lt; (abs (- (car p3) (car p4))) (abs (- (cadr p3 ) (cadr p4))))&lt;BR /&gt;(setq p4 (list (car p3) (cadr p4)))&lt;BR /&gt;(setq p4 (list (car p4) (cadr p3)))&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;(if (&amp;lt; (cadr p4)(cadr p3)) ;SORT P1 &amp;amp; P2 W/ RESPECT TO Y&lt;BR /&gt;(progn&lt;BR /&gt;(setq p p3)&lt;BR /&gt;(setq p3 p4)&lt;BR /&gt;(setq p4 p)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;(if (ssget "F" (list p3 p4) '((-4 . "&amp;lt;AND")(-4 . "&amp;lt;OR")(0 . "POLYLINE")(0 . "LWPOLYLINE")(0 . "LINE")(-4 . "OR&amp;gt;")&lt;BR /&gt;(-4 . "&amp;lt;OR")(8 . "UNIFORM_SUP")(8 . "BAND_SUP")(-4 . "OR&amp;gt;")(-4 . "AND&amp;gt;"))) ;DON"T DRAW LINE IF ALREADY EXISTS&lt;BR /&gt;(setq esup_exist 'Y)&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;(setq hp2 (getdist "Enter second highpoint cgs in inches: "))&lt;BR /&gt;(setq endrun "Y")&lt;BR /&gt;(while (= (strcase endrun) "Y")&lt;BR /&gt;;DETERMINE CORRESPONDING ENDPOINTS&lt;BR /&gt;(if (&amp;lt; (distance p1 p3)(distance p1 p4))&lt;BR /&gt;(progn&lt;BR /&gt;(setq epl1 (list p1 p3))&lt;BR /&gt;(setq epl2 (list p2 p4))&lt;BR /&gt;)&lt;BR /&gt;(progn&lt;BR /&gt;(setq epl1 (list p1 p4))&lt;BR /&gt;(setq epl2 (list p2 p3))&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;;DETERMINE END OF GREATEST DISTANCE&lt;BR /&gt;&lt;BR /&gt;(setq l1 (distance (car epl1) (cadr epl1)))&lt;BR /&gt;(setq l2 (distance (car epl2) (cadr epl2)))&lt;BR /&gt;(if (&amp;lt; l1 l2)&lt;BR /&gt;(setq l l2)&lt;BR /&gt;(setq l l1)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;;DETERMINE NO. OF SPACES&lt;BR /&gt;(if (= lp nil)&lt;BR /&gt;(progn&lt;BR /&gt;(setq ns (/ l maxspa))&lt;BR /&gt;(if (&amp;gt; (- ns (fix ns)) 0.01)&lt;BR /&gt;(setq ns (1+ (fix ns)))&lt;BR /&gt;(setq ns (fix ns))&lt;BR /&gt;)&lt;BR /&gt;;GENERATE ENDPOINTS OF SUPPORT BARS &amp;amp; DRAW&lt;BR /&gt;(if (= bsup_exist 'N)&lt;BR /&gt;(drawsup nil nil p1 p2 nil nil nil nil nil hp1 'cant t_layer)&lt;BR /&gt;)&lt;BR /&gt;(setq bsup_exist 'N)&lt;BR /&gt;(setq spacing (/ l1 ns)) ;USE l1 TO DETERMINE SPACING TO DETERMINE CHAIR HEIGHTS&lt;BR /&gt;(setq fact (/ 1.0 ns))&lt;BR /&gt;(setq n 1)&lt;BR /&gt;(while (&amp;lt; n ns) ;CANTILEVER SLAB&lt;BR /&gt;;AM NOT PASSING HIGH OR LOW POINT&lt;BR /&gt;(drawsup epl1 epl2 nil nil hp1 hp2 spacing n fact nil 'cant t_layer)&lt;BR /&gt;(setq n (1+ n))&lt;BR /&gt;)&lt;BR /&gt;(if (= esup_exist 'N)&lt;BR /&gt;(drawsup nil nil p3 p4 nil nil nil nil nil hp2 'cant t_layer)&lt;BR /&gt;)&lt;BR /&gt;(setq esup_exist 'N)&lt;BR /&gt;)&lt;BR /&gt;(progn&lt;BR /&gt;(if (= bsup_exist 'N)&lt;BR /&gt;(drawsup nil nil p1 p2 nil nil nil nil nil hp1 nil t_layer)&lt;BR /&gt;)&lt;BR /&gt;(setq bsup_exist 'N)&lt;BR /&gt;(setq ns (/ (/ l 2.0) maxspa))&lt;BR /&gt;(if (&amp;gt; (- ns (fix ns)) 0.01)&lt;BR /&gt;(setq ns (1+ (fix ns)))&lt;BR /&gt;(setq ns (fix ns))&lt;BR /&gt;)&lt;BR /&gt;(setq fact (/ 1.0 ns))&lt;BR /&gt;(setq spacing (/ (/ l1 2.0) ns)) ;USE l1 TO DETERMINE SPACING TO DETERMINE CHAIR HEIGHTS&lt;BR /&gt;(setq p5 (intpt epl1 0.5 1)) ;ENDPOINTS AT LOWPOINT&lt;BR /&gt;(setq p6 (intpt epl2 0.5 1))&lt;BR /&gt;(setq epl3 (list (car epl1) p5))&lt;BR /&gt;(setq epl4 (list (car epl2) p6))&lt;BR /&gt;(setq n 1)&lt;BR /&gt;(while (&amp;lt; n ns) ; SLAB W/ LOWPOINT&lt;BR /&gt;;AM NOT PASSING HIGH OR LOW POINT&lt;BR /&gt;(drawsup epl3 epl4 nil nil hp1 lp spacing n fact nil nil t_layer)&lt;BR /&gt;(setq n (1+ n))&lt;BR /&gt;)&lt;BR /&gt;(drawsup nil nil p5 p6 nil nil nil nil nil lp nil t_layer) ;LABEL LOWPOINT&lt;BR /&gt;(setq epl5 (list p5 (cadr epl1)))&lt;BR /&gt;(setq epl6 (list p6 (cadr epl2)))&lt;BR /&gt;(setq n 1)&lt;BR /&gt;(while (&amp;lt; n ns) ; SLAB W/ LOWPOINT&lt;BR /&gt;;AM NOT PASSING HIGH OR LOW POINT&lt;BR /&gt;(drawsup epl5 epl6 nil nil lp hp2 spacing n fact nil nil t_layer)&lt;BR /&gt;(setq n (1+ n))&lt;BR /&gt;)&lt;BR /&gt;(if (= esup_exist 'N)&lt;BR /&gt;(drawsup nil nil p3 p4 nil nil nil nil nil hp2 nil t_layer)&lt;BR /&gt;)&lt;BR /&gt;(setq esup_exist 'N)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;(setq lp (getdist "Enter next lowpoint cgs in inches if required, else return: "))&lt;BR /&gt;(if (= lp nil)&lt;BR /&gt;(progn&lt;BR /&gt;(initget "Y y N n")&lt;BR /&gt;(setq endrun (getkword "Continue current tendons? [Y or N] "))&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;(if (= (strcase endrun) "Y")&lt;BR /&gt;(progn&lt;BR /&gt;(setq p1 p3 p2 p4) :REASSIGN ENDPOINTS&lt;BR /&gt;(setq hp1 hp2) ;REASSIGN HIGHPOINTS&lt;/P&gt;&lt;P&gt;;GET SS OF TENDONS INTERSECTING SUPPORT LINE&lt;/P&gt;&lt;P&gt;(setq p3 (getpoint "Select both endpoints of uniform support at next highpoint: "))&lt;BR /&gt;(setq p4 (getpoint))&lt;BR /&gt;(terpri)&lt;BR /&gt;(if (= (getvar "orthomode") 1) ;MAKE P4 ORTHO W/ RESPECT TO P3 IF ORTHOMODE IS ON&lt;BR /&gt;(if (&amp;lt; (abs (- (car p3) (car p4))) (abs (- (cadr p3 ) (cadr p4))))&lt;BR /&gt;(setq p4 (list (car p3) (cadr p4)))&lt;BR /&gt;(setq p4 (list (car p4) (cadr p3)))&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;(if (&amp;lt; (cadr p4)(cadr p3)) ;SORT P1 &amp;amp; P2 W/ RESPECT TO Y&lt;BR /&gt;(progn&lt;BR /&gt;(setq p p3)&lt;BR /&gt;(setq p3 p4)&lt;BR /&gt;(setq p4 p)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;(if (ssget "F" (list p1 p2) '((-4 . "&amp;lt;AND")(-4 . "&amp;lt;OR")(0 . "POLYLINE")(0 . "LWPOLYLINE")(0 . "LINE")(-4 . "OR&amp;gt;")&lt;BR /&gt;(-4 . "&amp;lt;OR")(8 . "UNIFORM_SUP")(8 . "BAND_SUP")(-4 . "OR&amp;gt;")(-4 . "AND&amp;gt;"))) ;DON"T DRAW LINE IF ALREADY EXISTS&lt;BR /&gt;(setq sup_exist 'Y)&lt;BR /&gt;)&lt;BR /&gt;(setq hp2 (getdist "Enter highpoint cgs in inches: "))&lt;BR /&gt;);END PROGN&lt;BR /&gt;(progn&lt;BR /&gt;(initget "Y y N n")&lt;BR /&gt;(setq continue (getkword "Continue program ? [Y or N] "))&lt;BR /&gt;)&lt;BR /&gt;);END IF&lt;BR /&gt;) ;END WHILE&lt;BR /&gt;) ;END WHILE&lt;BR /&gt;(setvar "attdia" 1)&lt;BR /&gt;) ;END DEFUN&lt;BR /&gt;&lt;BR /&gt;(defun drawsup (pl1 pl2 pt1 pt2 h1 h2 s n f fh c lname / ncl) ;nc - GLOBAL VARIABLE&lt;BR /&gt;(if (not fh) ;COMPUTE SUPPORT HEIGHT AT INTERMEDIATE SUPPORTS&lt;BR /&gt;(progn&lt;BR /&gt;(setq barep1 (intpt pl1 f n))&lt;BR /&gt;(setq barep2 (intpt pl2 f n))&lt;BR /&gt;(setq xd (* n s))&lt;BR /&gt;(if c&lt;BR /&gt;(setq span (* 2.0 l1))&lt;BR /&gt;(setq span l1)&lt;BR /&gt;)&lt;BR /&gt;(if (&amp;gt;= h1 h2)&lt;BR /&gt;(setq h (shtgen1 span xd a1 0.5 h1 h2)) ;USE L1 AS SPACING IS BASED ON L1&lt;BR /&gt;(setq h (shtgen2 span (+ (/ span 2.0) xd) a1 0.5 h1 h2)) ; NOTE: e1 IS e2 &amp;amp; e2 IS e3 IN THE FUNCTION&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;(progn ;SUPPORT HEIGHT IS AT HIGH OR LOW POINT&lt;BR /&gt;(setq barep1 pt1)&lt;BR /&gt;(setq barep2 pt2)&lt;BR /&gt;(setq h fh)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;(setq d (+ (distance barep1 barep2) 44.5)) ;DISTANCE TO FIND OFFSET OF SUPPORT 3'8.5"&lt;BR /&gt;(setq a (angle barep1 barep2)) ;ANGLE OF SUPPORT LINE RELATIVE TO X AXIS IN RADIANS&lt;BR /&gt;(setq ad (* (/ a pi) 180)) ;ANGLE IN DEGREES&lt;BR /&gt;(if (and (&amp;lt; ad 270) (&amp;gt; ad 90)) ;DETERMINE BLOCK ROTATION ANGLE&lt;BR /&gt;(progn&lt;BR /&gt;(setq bad (+ 180 ad)) ;ROTATION ANGLE FOR CHAIR BLOCK INSERTION&lt;BR /&gt;(setq baroff (- a (/ pi 4.0))) ;ANGLE FOR BLOCK OFFSET IN RADIANS TO COMPUTE IP&lt;BR /&gt;)&lt;BR /&gt;(progn&lt;BR /&gt;(setq bad ad)&lt;BR /&gt;(setq baroff (+ a (/ pi 4.0)))&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;(setq ip (list (+ (car barep1) (* d (cos a)) (* (/ (getvar "dimscale") 32)(cos baroff)))&lt;BR /&gt;(+ (cadr barep1) (* d (sin a))(* (/ (getvar "dimscale") 32)(sin baroff)))))&lt;BR /&gt;&lt;BR /&gt;(if (= t_layer "UNIFORM")&lt;BR /&gt;(command "line" barep1 barep2 "") ;DRAW UNIFORM SUPPORTS&lt;BR /&gt;(progn ;DRAW BAND SUPPORTS&lt;BR /&gt;(setq bandass (list '(1 24.0 2) '(2 24.0 2) '(3 36.0 2) '(4 48.0 3) '(5 60.0 3) '(6 72.0 4) '(7 84.0 4)))&lt;BR /&gt;(setq dx2 (* d 2.0))&lt;BR /&gt;(setq bn nil)&lt;BR /&gt;(setq bip (list (+ (car barep1)(* d (cos a)))(+ (cadr barep1) (* d (sin a)))))&lt;BR /&gt;;(setq nc "(2)")&lt;BR /&gt;;(cond ((&amp;lt;= dx2 24.0)&lt;BR /&gt;; (setq bn "C:/apps/PT_CAD/rebar/bndsup24.dwg"))&lt;BR /&gt;; ((and (&amp;gt; dx2 24.0) (&amp;lt;= dx2 36.0))&lt;BR /&gt;; (setq bn "C:/apps/PT_CAD/rebar/bndsup36.dwg"))&lt;BR /&gt;; ((and (&amp;gt; dx2 36.0) (&amp;lt;= dx2 48.0))&lt;BR /&gt;; (setq nc "(3)")&lt;BR /&gt;; (setq bn "C:/apps/PT_CAD/rebar/bndsup48.dwg"))&lt;BR /&gt;; ((and (&amp;gt; dx2 48.0) (&amp;lt;= dx2 60.0))&lt;BR /&gt;; (setq nc "(3)")&lt;BR /&gt;; (setq bn "C:/apps/PT_CAD/rebar/bndsup60.dwg"))&lt;BR /&gt;; ((and (&amp;gt; dx2 60.0) (&amp;lt;= dx2 72.0))&lt;BR /&gt;; (setq nc "(4)")&lt;BR /&gt;; (setq bn "C:/apps/PT_CAD/rebar/bndsup72.dwg"))&lt;BR /&gt;; ((and (&amp;gt; dx2 72.0) (&amp;lt;= dx2 84.0))&lt;BR /&gt;; (setq bn "C:/apps/PT_CAD/rebar/bndsup84.dwg")&lt;BR /&gt;; (setq nc "(4)"))&lt;BR /&gt;&lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;BR /&gt;(if (/= bn nil)&lt;BR /&gt;(command "insert" bn bip "" "" bad)&lt;BR /&gt;(progn&lt;BR /&gt;(command "line" barep1 barep2 "")&lt;BR /&gt;(setq nc "(3)")&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;;GET SUPPORT HEIGHT AND CHAIR QUANTITY&lt;BR /&gt;(command "layer" "T" (strcat t_layer "_sup_text") "")&lt;BR /&gt;(setvar "CLAYER" (strcat lname "_sup_text"))&lt;BR /&gt;(setq nnc (atoi (substr (substr nc 1 (1- (strlen nc))) 2))) ;GET NUMERIC CHAIR QUANTITY FROM STRING&lt;BR /&gt;(if (&amp;lt; h 1.5) ;BEGIN * DETAIL AT 1.875 CGS (1-1/4" IS SHORTEST NON-STAR DETAIL CHAIR)&lt;BR /&gt;(progn&lt;BR /&gt;(if (and (= (strcase lpmethod) "C") (&amp;gt;= h 1.0))&lt;BR /&gt;(progn&lt;BR /&gt;(setq ch (- h 0.25)) ;COMPUTE CHAIR HEIGHT FOR SINGLE-STAR DETAIL&lt;BR /&gt;(setq ncl (strcat nc " SB"))&lt;BR /&gt;(if&lt;BR /&gt;(command "insert" "C:/apps/PT_CAD/pt_supt/chair2" ip (getvar "dimscale") "" bad (strcat (spins ch) " SB"))&lt;BR /&gt;(command "insert" "C:/apps/PT_CAD/pt_supt/chair" ip (getvar "dimscale") "" bad ncl (spins ch))&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;(progn&lt;BR /&gt;(setq lab (strcat (spins h) " CGS **")) ;LABEL LOWPOINT WHEN SUPPORTING W/O CHAIR&lt;BR /&gt;(command "text" "j" "c" ip bad lab)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;(progn&lt;BR /&gt;(setq ch (- h 0.75)) ;COMPUTE CHAIR HEIGHT&lt;BR /&gt;(if (&amp;lt; nnc 3)&lt;BR /&gt;(command "insert" "C:/apps/PT_CAD/pt_supt/chair2" ip (getvar "dimscale") "" bad (spins ch))&lt;BR /&gt;(command "insert" "C:/apps/PT_CAD/pt_supt/chair" ip (getvar "dimscale") "" bad nc (spins ch))&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;(command "layer" "T" (strcat t_layer "_sup") "")&lt;BR /&gt;(setvar "CLAYER" (strcat lname "_sup"))&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;(defun intpt (l fac i / x y)&lt;BR /&gt;&lt;BR /&gt;(setq x (+ (car (car l)) (* (* (- (car (cadr l))(car (car l))) fac) i)))&lt;BR /&gt;(setq y (+ (cadr (car l)) (* (* (- (cadr (cadr l))(cadr (car l))) fac) i)))&lt;BR /&gt;(list x y)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;(defun shtgen1 (l x a1 a2 e1 e2 / y)&lt;BR /&gt;(if (and (&amp;lt; (/ x l) a1) (/= a1 0))&lt;BR /&gt;(setq y (- e1 (* (/ (- e1 e2) (* (expt l 2) a1 a2)) (expt x 2))))&lt;BR /&gt;(setq y (+ e2 (* (/ (- e1 e2) (* (expt l 2) a2 (- a2 a1))) (expt (- x (* a2 l)) 2))))&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;(defun shtgen2 (l x a3 a2 e2 e3 / y)&lt;BR /&gt;(if (and (&amp;gt; x (- l (* l a3))) (/= a1 0))&lt;BR /&gt;(setq y (- e3 (* (/ (- e3 e2) (* (expt l 2) (- 1 a2) a3)) (expt (- x l) 2))))&lt;BR /&gt;(setq y (+ e2 (* (/ (- e3 e2) (* (expt l 2) (- 1 a2) (- 1 a2 a3))) (expt (- x (* a2 l)) 2))))&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;(defun spins (c) ;FUNCTION TO INSERT SPECIAL CHARACTERS @ FRACTIONS&lt;BR /&gt;(setq c (rtos c 5 2))&lt;BR /&gt;(if (/= (strlen c) 1)&lt;BR /&gt;(if (= (substr c (1- (strlen c)) 1) "/") ;FIND NEXT-TO-LAST DIGIT IN FRACTION&lt;BR /&gt;(if (&amp;gt; (strlen c) 3)&lt;BR /&gt;(setq c (strcat (substr c 1 (- (strlen c) 4)) ;CONVERT TO SPECIAL FONT IF &amp;gt; 7/8"&lt;BR /&gt;(cadr (assoc (substr c (- (strlen c) 2) 3)&lt;BR /&gt;scarl))&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;(setq c (cadr (assoc c scarl))) ;CONVERT TO SPECIAL FONT IF &amp;lt;= 7/8"&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;(eval c)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;(defun tend_cnt (ss pt1 pt2 / pl en cl) ;FUNCTION TO LIST ALL VERTICES POINTS TO DETERMINE CHAIR QUANT.&lt;BR /&gt;(setq apl '()) ;INITIALIZE LIST OF POINT LISTS (ONE POINT LIST PER SS ENTITY)&lt;BR /&gt;(setq n 0)&lt;BR /&gt;(setq ne (sslength ss)) ; NUMBER OF ENTITIES IN SELECTION SET&lt;BR /&gt;(while (&amp;lt; n ne)&lt;BR /&gt;(setq pl '()) ;INITIALIZE POINT LIST&lt;BR /&gt;(setq en (cdr (car (entget (ssname ss n))))) ;GET ENTITY NAME OF FIRST ENTITY IN SELECTION SET&lt;BR /&gt;(if (= (cdr (assoc 0 (entget en))) "POLYLINE") ;DETERMINE IF POLYLINE OR LWPOLYLINE&lt;BR /&gt;(progn&lt;BR /&gt;(setq en (cdr (car (entget (entnext en)))))&lt;BR /&gt;(while (/= (cdr (assoc 0 (entget en))) "SEQEND") ;BUILD LIST OF VERTICES AT POLYLINE&lt;BR /&gt;(setq pl (cons (cdr (assoc 10 (entget en))) pl)) ; GET POINT AND ADD TO LIST&lt;BR /&gt;(setq en (cdr (car (entget (entnext en))))) ; GET ENTITY NAME&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;(progn&lt;BR /&gt;(setq cl (entget en)) ;BUILD LIST OF VERTICES AT LWPOLYLINE&lt;BR /&gt;(setq i 0)&lt;BR /&gt;(while (&amp;lt; i (length cl))&lt;BR /&gt;(if (= (car (nth i cl)) 10)&lt;BR /&gt;(setq pl (cons (cdr (nth i cl)) pl ))&lt;BR /&gt;)&lt;BR /&gt;(setq i (1+ i))&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;(setq apl (cons pl apl))&lt;BR /&gt;(setq n (1+ n))&lt;BR /&gt;)&lt;BR /&gt;;FIND INTERSECTION POINT BETWEEN END POINTS OF SUPPORT BAR AND 2 NEAREST NODES IN TENDON POLYLINE&lt;BR /&gt;(setq int_ptl '())&lt;BR /&gt;(setq ln (length apl))&lt;BR /&gt;(setq i 0)&lt;BR /&gt;(while (&amp;lt; i ln) ;ITERATE THRU LIST OF POINT LISTS&lt;BR /&gt;(setq min_dist 10000.0)&lt;BR /&gt;(setq int_pt nil)&lt;BR /&gt;(setq ptlist (nth i apl))&lt;BR /&gt;(setq lpl (length ptlist))&lt;BR /&gt;(setq n 0)&lt;BR /&gt;(while (&amp;lt; n (1- lpl)) ;ITERATE THRU POINT LIST, STOPPING 1 SHORT OF END&lt;BR /&gt;(setq base_pt (nth n ptlist))&lt;BR /&gt;(setq k (1+ n))&lt;BR /&gt;(while (&amp;lt; k lpl)&lt;BR /&gt;(setq comp_pt (nth k ptlist))&lt;BR /&gt;(if (setq test_pt (inters pt1 pt2 base_pt comp_pt))&lt;BR /&gt;(progn&lt;BR /&gt;(setq test_dist (distance base_pt comp_pt))&lt;BR /&gt;(if (&amp;lt; test_dist min_dist)&lt;BR /&gt;(progn&lt;BR /&gt;(setq int_pt test_pt)&lt;BR /&gt;(setq min_dist test_dist)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;(setq k (1+ k))&lt;BR /&gt;)&lt;BR /&gt;(setq n (1+ n))&lt;BR /&gt;)&lt;BR /&gt;(setq int_ptl (cons int_pt int_ptl))&lt;BR /&gt;(setq i (1+ i))&lt;BR /&gt;)&lt;BR /&gt;;(count int_ptl (cdr int_ptl) (car int_ptl) 0)&lt;BR /&gt;(nocoin int_ptl)&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;;FUNCTION TO COUNT NONCOINCIDENT TENDONS&lt;BR /&gt;(defun count (pl cl tp n) ;POINT LIST, COMPARISON LIST, TEST POINT, POINT COUNTER - HOLD TP CONSTANT&lt;BR /&gt;(cond ((= (length pl) 2) ;PROCESS LAST 2 POINTS IN PL&lt;BR /&gt;(if (&amp;lt; (distance tp (car cl)) 2.0)&lt;BR /&gt;(1+ n) ;ADD 1 IF LAST 2 POINTS ARE COINCIDENT&lt;BR /&gt;(+ n 2) ;ADD 2 IF LAST 2 POINTS ARE SEPARATE&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;((= (length cl) 1) ;INCREMENT N IF LAST POINT IN COMPARISON LIST IS NONCOINCIDENT&lt;BR /&gt;(if (&amp;lt; (distance tp (car cl)) 2.0)&lt;BR /&gt;(count (cdr pl)(cddr pl)(cadr pl) n)&lt;BR /&gt;(count (cdr pl)(cddr pl)(cadr pl) (1+ n))&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;((&amp;lt; (distance tp (car cl)) 2.0) ;IF TEST POINT (FIRST POINT IN PL) IS COINCIDENT W/ (car CL)&lt;BR /&gt;(count (cdr pl)(cddr pl)(cadr pl) n) ;MAKE RECURSIVE CALL TO DELETE FIRST POINT&lt;BR /&gt;)&lt;BR /&gt;(T&lt;BR /&gt;(count pl (cdr cl) tp n) ;MAKE RECURSIVE CALL TO COMPARE TEST POINT TO NEXT POINT IN COMPARISON LIST&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;(defun nocoin (pl / rl n lo li i n) ;COUNT NONCOINCIDENTAL POINTS&lt;BR /&gt;(setq rl '())&lt;BR /&gt;(setq lo (1- (length pl))) ;UPPER LIMIT AT OUTER LOOP&lt;BR /&gt;(setq li (length pl)) ;UPPER LIMIT AT INNER LOOP&lt;BR /&gt;(setq i 0)&lt;BR /&gt;(while (&amp;lt; i lo) ;OUTER LOOP TO INCREMENT COMPARISON POINT&lt;BR /&gt;(setq cp (nth i pl))&lt;BR /&gt;(setq n (1+ i))&lt;BR /&gt;(setq f 'off)&lt;BR /&gt;(while (&amp;lt; n li) ;INNER LOOP TO ITERATE THRU REMAINDER OF LIST&lt;BR /&gt;(if (&amp;lt; (distance cp (nth n pl)) 6.0)&lt;BR /&gt;(progn&lt;BR /&gt;(setq n (1+ li))&lt;BR /&gt;(setq f 'on)&lt;BR /&gt;)&lt;BR /&gt;(setq n (1+ n))&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;(if (= f 'off)&lt;BR /&gt;(setq rl (cons cp rl))&lt;BR /&gt;)&lt;BR /&gt;(setq i (1+ i))&lt;BR /&gt;)&lt;BR /&gt;(setq rl (cons (car (reverse pl)) rl)) ;ADD LAST MEMBER OF PL TO RL&lt;BR /&gt;(length rl)&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Jun 2023 17:17:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-command-to-determine-the-insertion-point-of-a-block/m-p/12005059#M29126</guid>
      <dc:creator>isrsol702</dc:creator>
      <dc:date>2023-06-01T17:17:48Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp command to determine the insertion point of a block</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-command-to-determine-the-insertion-point-of-a-block/m-p/12005130#M29127</link>
      <description>What are "support lines"? Consider sharing a DWG file with all these elements and blocks in it already, show intent/wish on one side, and "problem" on the other side.</description>
      <pubDate>Thu, 01 Jun 2023 17:41:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-command-to-determine-the-insertion-point-of-a-block/m-p/12005130#M29127</guid>
      <dc:creator>pendean</dc:creator>
      <dc:date>2023-06-01T17:41:03Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp command to determine the insertion point of a block</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-command-to-determine-the-insertion-point-of-a-block/m-p/12005394#M29128</link>
      <description>&lt;P&gt;don't post code in the message like you did then we'll end up seeing happy face symbols instead of the complete code.&lt;/P&gt;&lt;P&gt;use &lt;STRONG&gt;&amp;lt;/&amp;gt; Insert/Edit code sample&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="paullimapa_0-1685646465997.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1222576i5BFF4D0B76E8D2A4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="paullimapa_0-1685646465997.png" alt="paullimapa_0-1685646465997.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Just doing a quick glance, the chair insert part of the code happens in 2 locations.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The first is here:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(if
(command "insert" "C:/apps/PT_CAD/pt_supt/chair2" ip (getvar "dimscale") "" bad (strcat (spins ch) " SB"))
(command "insert" "C:/apps/PT_CAD/pt_supt/chair" ip (getvar "dimscale") "" bad ncl (spins ch))
)&lt;/LI-CODE&gt;&lt;P&gt;The second is here:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(if (&amp;lt; nnc 3)
(command "insert" "C:/apps/PT_CAD/pt_supt/chair2" ip (getvar "dimscale") "" bad (spins ch))
(command "insert" "C:/apps/PT_CAD/pt_supt/chair" ip (getvar "dimscale") "" bad nc (spins ch))
)&lt;/LI-CODE&gt;&lt;P&gt;They both use &lt;STRONG&gt;ip&lt;/STRONG&gt; as the variable for the insertion point of the chair symbols.&lt;/P&gt;&lt;P&gt;Looking further up in the code ip is defined here:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(setq ip (list (+ (car barep1) (* d (cos a)) (* (/ (getvar "dimscale") 32)(cos baroff)))
(+ (cadr barep1) (* d (sin a))(* (/ (getvar "dimscale") 32)(sin baroff)))))&lt;/LI-CODE&gt;&lt;P&gt;But since you want to place the chairs at the end of the bar line, this time doing a search for the start and end points of the drawn bar line shows here:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(if (not fh) ;COMPUTE SUPPORT HEIGHT AT INTERMEDIATE SUPPORTS
(progn
(setq barep1 (intpt pl1 f n))
(setq barep2 (intpt pl2 f n))
(setq xd (* n s))&lt;/LI-CODE&gt;&lt;P&gt;and again here:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(progn ;SUPPORT HEIGHT IS AT HIGH OR LOW POINT
(setq barep1 pt1)
(setq barep2 pt2)
(setq h fh)
)&lt;/LI-CODE&gt;&lt;P&gt;Then the code draws the line here:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(command "line" barep1 barep2 "") ;DRAW UNIFORM SUPPORTS&lt;/LI-CODE&gt;&lt;P&gt;My best guess is that the end of the support line should be at barep2.&lt;/P&gt;&lt;P&gt;So I would change the setq ip variable from this:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(setq ip (list (+ (car barep1) (* d (cos a)) (* (/ (getvar "dimscale") 32)(cos baroff)))
(+ (cadr barep1) (* d (sin a))(* (/ (getvar "dimscale") 32)(sin baroff)))))&lt;/LI-CODE&gt;&lt;P&gt;to this:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(setq ip barep2) ; end of support line&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Jun 2023 19:18:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-command-to-determine-the-insertion-point-of-a-block/m-p/12005394#M29128</guid>
      <dc:creator>paullimapa</dc:creator>
      <dc:date>2023-06-01T19:18:35Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp command to determine the insertion point of a block</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-command-to-determine-the-insertion-point-of-a-block/m-p/12005911#M29129</link>
      <description>&lt;P&gt;Pardon my ignorance, I'm not too familiar with coding but if Im not mistaken, I should erase and replace these lines&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;(setq ip (list (+ (car barep1) (* d (cos a)) (* (/ (getvar "dimscale") 32)(cos baroff)))
(+ (cadr barep1) (* d (sin a))(* (/ (getvar "dimscale") 32)(sin baroff)))))&lt;/PRE&gt;&lt;P&gt;with this instead? correct?&lt;/P&gt;&lt;PRE&gt;(setq ip barep2) ; end of support line&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jun 2023 00:51:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-command-to-determine-the-insertion-point-of-a-block/m-p/12005911#M29129</guid>
      <dc:creator>isrsol702</dc:creator>
      <dc:date>2023-06-02T00:51:18Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp command to determine the insertion point of a block</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-command-to-determine-the-insertion-point-of-a-block/m-p/12005926#M29130</link>
      <description>&lt;P&gt;Yep give it try&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jun 2023 01:03:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-command-to-determine-the-insertion-point-of-a-block/m-p/12005926#M29130</guid>
      <dc:creator>paullimapa</dc:creator>
      <dc:date>2023-06-02T01:03:06Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp command to determine the insertion point of a block</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-command-to-determine-the-insertion-point-of-a-block/m-p/12008298#M29131</link>
      <description>&lt;P&gt;Use "-Insert" also it will avoid any problems with block dialouge boxes being called.&lt;/P&gt;</description>
      <pubDate>Sat, 03 Jun 2023 00:07:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-command-to-determine-the-insertion-point-of-a-block/m-p/12008298#M29131</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2023-06-03T00:07:59Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp command to determine the insertion point of a block</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-command-to-determine-the-insertion-point-of-a-block/m-p/12021987#M29132</link>
      <description>&lt;P&gt;I was barely able to try this but it didnt' work, I will post some screen shots to communicate my intends better. Thanks&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 05:36:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-command-to-determine-the-insertion-point-of-a-block/m-p/12021987#M29132</guid>
      <dc:creator>isrsol702</dc:creator>
      <dc:date>2023-06-09T05:36:13Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp command to determine the insertion point of a block</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-command-to-determine-the-insertion-point-of-a-block/m-p/12022001#M29133</link>
      <description>&lt;P&gt;Hi Pedean&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Support Bars are the magenta lines on the attached image, The chair heights is the block I want to modify to get inserted at the end of the support lines. I'd been trying for a while but no luck. any help will be greatly appreciated&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 05:54:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-command-to-determine-the-insertion-point-of-a-block/m-p/12022001#M29133</guid>
      <dc:creator>isrsol702</dc:creator>
      <dc:date>2023-06-09T05:54:47Z</dc:date>
    </item>
  </channel>
</rss>

