<?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: Using the Trim Command in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-the-trim-command/m-p/12588456#M17263</link>
    <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/15026899"&gt;@Abby_Baratta&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My brain hurts reading your answer&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":face_with_head_bandage:"&gt;🤕&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Isn't the purpose of your TRIM command to remove part of the circle to where the U shape intersects the circle? So it will be (or appear to be) one shape?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you have to create 2 additional lines to trim your circle to (instead of using your U shape lines) then it would sound like the U shape is not adhering to its intended purpose.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While I can agree with the concept of "getting something to just work", it seems a bit far-fetched for this routine since we should already have all of the linework necessary to perform our trim command.&lt;/P&gt;</description>
    <pubDate>Wed, 28 Feb 2024 16:30:19 GMT</pubDate>
    <dc:creator>CodeDing</dc:creator>
    <dc:date>2024-02-28T16:30:19Z</dc:date>
    <item>
      <title>Using the Trim Command</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-the-trim-command/m-p/12586327#M17253</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've recently been trying to work with an AutoLISP routine that was written in 1997 and I've run into a few problems with the TRIM command. I haven't worked much with trim commands in general, so I've been doing my best to piece together what it's trying to do.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I know that when this code was originally written, you would give the TRIM command some reference lines and then a point so that it could trim the desired section of the line. When you type TRIM into the command line now, however, I see that you're able to hover over a section of a line and it will assume what the section of line that you're looking to trim is.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my case, I'm looking to trim off the top section of a circle, as shown below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Abby_Baratta_0-1709062426590.png" style="width: 293px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1330975iF1D826B8641BBA8F/image-dimensions/293x274?v=v2" width="293" height="274" role="button" title="Abby_Baratta_0-1709062426590.png" alt="Abby_Baratta_0-1709062426590.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Abby_Baratta_1-1709062551183.png" style="width: 293px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1330977iA7C81F6C3CD031E8/image-dimensions/293x310?v=v2" width="293" height="310" role="button" title="Abby_Baratta_1-1709062551183.png" alt="Abby_Baratta_1-1709062551183.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The image on top is what I'm currently working with and the image on the bottom is what I'm looking to get to (ignoring all the added centerlines, angles, and pass lanes of course).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As of right now, the code that is written into the program is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="lisp"&gt;   (command "trim" NOZL "" "" (polar BASEPT3 ( + LNOZANG (* 0.5 pi)) (* 0.5 TSTDIA)) "" "")
  (setq TRIMMER (ssadd (entlast)))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this case, the NOZL selection set is referring to the 3/4 of a rectangle that is sitting on top of the circle. I've verified that the polar command that is spitting out a reference point is doing so correctly, with the point being at the very top of the circle, directly between the legs of the NOZL selection set.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried adding (initcommandversion) before the line, as well as using "_.TRIM" instead of what I've currently got, but it still won't get rid of that section of the circle.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help or insight into how the TRIM command works would be greatly appreciated!&lt;/P&gt;</description>
      <pubDate>Tue, 27 Feb 2024 19:42:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-the-trim-command/m-p/12586327#M17253</guid>
      <dc:creator>Abby_Baratta</dc:creator>
      <dc:date>2024-02-27T19:42:28Z</dc:date>
    </item>
    <item>
      <title>Re: Using the Trim Command</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-the-trim-command/m-p/12586366#M17254</link>
      <description>&lt;P&gt;This seemed to get the code to not throw an error and stop, but it didn't actually remove the portion of the circle:&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;(setq nozlpt (polar BASEPT3 ( + LNOZANG (* 0.5 pi)) (* 0.5 TSTDIA)))
(initcommandversion)
(command "_.trim" nozlpt "")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Feb 2024 20:02:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-the-trim-command/m-p/12586366#M17254</guid>
      <dc:creator>Abby_Baratta</dc:creator>
      <dc:date>2024-02-27T20:02:43Z</dc:date>
    </item>
    <item>
      <title>Re: Using the Trim Command</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-the-trim-command/m-p/12586618#M17255</link>
      <description>&lt;P&gt;Not sure why you need a shortcut or are you drawing entire object using a lisp ? If so post all the code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;TRIM, pick vert line 1, pick vert line 2, Enter, pick circle, Enter, all done ??&lt;/P&gt;</description>
      <pubDate>Tue, 27 Feb 2024 22:26:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-the-trim-command/m-p/12586618#M17255</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2024-02-27T22:26:01Z</dc:date>
    </item>
    <item>
      <title>Re: Using the Trim Command</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-the-trim-command/m-p/12586665#M17256</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/15026899"&gt;@Abby_Baratta&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;This seemed to get the code to not throw an error and stop&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Errors are actually important! They help us potentially understand where the code went wrong and in what way. You should include them in any post where something is going wrong.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/15026899"&gt;@Abby_Baratta&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;...but it didn't actually remove the portion of the circle:&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Sometimes your object snaps can cause some chaos.. try updating to this code:&lt;/P&gt;&lt;P&gt;(i added "non" to temporarily remove snaps when you select your trim point, and also removed (initcommandversion) since there is no dialog version of trim that I am aware of)&lt;/P&gt;&lt;LI-CODE lang="lisp"&gt;(setq nozlpt (polar BASEPT3 ( + LNOZANG (* 0.5 pi)) (* 0.5 TSTDIA)))
(command "_.trim" "non" nozlpt "")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;...and if that's no help, then yes we will need more information to understand your code &amp;amp; its purpose better.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;</description>
      <pubDate>Tue, 27 Feb 2024 22:57:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-the-trim-command/m-p/12586665#M17256</guid>
      <dc:creator>CodeDing</dc:creator>
      <dc:date>2024-02-27T22:57:09Z</dc:date>
    </item>
    <item>
      <title>Re: Using the Trim Command</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-the-trim-command/m-p/12587568#M17257</link>
      <description>&lt;P&gt;Wouldn't be more convenient just BREAK the circle?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(defun c:breakcircle ( / e p r)
  (if (and (setq e (car (entsel "\nSelect circle: ")))
	   (setq p (cdr (assoc 10 (entget e))))
	   (setq r (cdr (assoc 40 (entget e))))
	   )
    (command "_.break" e
	     "_non" (polar p (- (* 0.5 pi) (cvunit 30 "degree" "radian")) r)
	     "_non" (polar p (+ (* 0.5 pi) (cvunit 30 "degree" "radian")) r)))
  (princ)
  )
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2024 10:42:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-the-trim-command/m-p/12587568#M17257</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2024-02-28T10:42:11Z</dc:date>
    </item>
    <item>
      <title>Re: Using the Trim Command</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-the-trim-command/m-p/12587633#M17258</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/15026899"&gt;@Abby_Baratta&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;... it didn't actually remove the portion of the circle: ....&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That would be the result &lt;STRONG&gt;&lt;EM&gt;if&lt;/EM&gt;&lt;/STRONG&gt; the vertical Lines [or end Polyline segments, or whatever they are] fall short of actually touching the Circle.&amp;nbsp; Could that be the cause?&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2024 11:22:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-the-trim-command/m-p/12587633#M17258</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2024-02-28T11:22:01Z</dc:date>
    </item>
    <item>
      <title>Re: Using the Trim Command</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-the-trim-command/m-p/12587852#M17259</link>
      <description>&lt;P&gt;That did not end up working. I had EXPERT set to 5, so I changed it to 0 and it still didn't show any errors, so I'm not sure why it's not stopping, but also not trimming anything.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This portion of the code is designed to draw the circle, draw the nozzle on top of the circle, and trim out the arc underneath the nozzle. Some of the variables that we define earlier include:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BASEPT3 - point designated to be the center of the circle&lt;/P&gt;&lt;P&gt;TSTDIA - length designated to be the diameter of the circle&lt;/P&gt;&lt;P&gt;LNOZANG - angle of the nozzle&lt;/P&gt;&lt;P&gt;LNOZHT - height of the nozzle&lt;/P&gt;&lt;P&gt;NOZRAD - radius of the nozzle&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And this is the whole portion of code that draws and trims the circle and nozzle:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="lisp"&gt;(if (or COREONLY (= DWGTYP "CORE"))(progn
 ;
 (if (&amp;gt; USIZE 2.00)(progn
  (command "circle" BASEPT3 "D" TSTDIA)
  (setq TRIMMER (ssadd (entlast)))
 ))
 ; 
 (if (= USIZE 2.00)(progn
  (setq p1 (polar BASEPT3 UP (* 0.5 TSTDIA)))
  (setq p1 (polar p1 LFT (* 0.5 TSTDIA)))
  (setq p2 (polar p1 RGT TSTDIA))
  (setq p3 (polar p2 DWN TSTDIA))
  (setq p4 (polar p1 DWN TSTDIA))
  ;
  (command "pline" p1 p2 p3 p4 "C")
  (command "fillet" "p" (entlast))
  (setq TRIMMER (ssadd (entlast)))
  ;
 ))

(setq A (+ LNOZANG (* 0.5 pi)))
(setq B (+ LNOZANG pi))
;
(setq P1 (polar BASEPT3 A LNOZHT))
(setq P2 (polar P1 B LNOZRAD))
(setq P3 (polar P1 (+ B pi) LNOZRAD))
(setq P4 (polar P2 (+ A pi) 0.1))
(setq P5 (polar P3 (+ A pi) 0.1))
(setq LNZTOP P3)
(if (= LNOZANG SC_BACK)(setq LNZTOP (polar P1 UP LNOZRAD)))
(if (= LNOZANG SC_DWN)(setq LNZTOP (polar P1 RGT LNOZRAD)))
(if (= LNOZANG SC_FRNT)(setq LNZTOP (polar P1 UP LNOZRAD)))
;
(command "pline" P5 P3 P2 P4 "")
(setq NOZL (ssadd (entlast)))
(command "EXTEND" TRIMMER "" P4 P5 "")
(setq NOZL (ssadd (entlast)))
;
(if (= modl/ "SC")(progn
 (if (and (or (= DWGTYP "CORE") COREONLY)(= LNOZANG RNOZANG))(progn
;   (command "trim" NOZL "" "" (polar BASEPT3 ( + LNOZANG (* 0.5 pi)) (* 0.5 TSTDIA)) "" "")

;testing
(setq nozlpt (polar BASEPT3 ( + LNOZANG (* 0.5 pi)) (* 0.5 TSTDIA)))
(initcommandversion)
(command "_.trim"  "non" nozlpt "")

  (setq TRIMMER (ssadd (entlast)))
 ))
))
&lt;/LI-CODE&gt;&lt;P&gt;I have ensured that LNOZANG does in fact equal RNOZANG, so the code is actually going into that if statement.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It still runs all the way through the rest of the drawing process that comes after this point, but it isn't throwing errors for me to look at or trimming.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2024 13:09:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-the-trim-command/m-p/12587852#M17259</guid>
      <dc:creator>Abby_Baratta</dc:creator>
      <dc:date>2024-02-28T13:09:47Z</dc:date>
    </item>
    <item>
      <title>Re: Using the Trim Command</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-the-trim-command/m-p/12588289#M17260</link>
      <description>&lt;P&gt;Should your pre-code list of variables include &lt;STRONG&gt;L&lt;/STRONG&gt;NOZRAD [which is called for in the code but not defined], either instead of or in addition to NOZRAD?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We also don't have any information about some other variables [modl/, SC_BACK, SC-DWN, SC-FRNT, DWGTYPE, COREONLY], the last two of which we may be clever enough to figure out how to ignore, nor some others we can probably guess at [LFT, RFT, DWN].&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We don't know your current Fillet radius, for line 16 -- if it's zero, I don't see the purpose in doing that, but if it's not zero, I don't see anything in the images that could relate to it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since we can't really test your code without those various other variables, it's hard to picture what's going on, and I'm reluctant to wade in deep enough to figure it all out.&amp;nbsp; Post a drawing file, with those variable things &lt;EM&gt;identified&lt;/EM&gt;.&amp;nbsp; I'm still betting on the Circle not actually being touched by what you want to Trim it between [see my previous Reply].&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2024 15:43:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-the-trim-command/m-p/12588289#M17260</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2024-02-28T15:43:17Z</dc:date>
    </item>
    <item>
      <title>Re: Using the Trim Command</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-the-trim-command/m-p/12588385#M17261</link>
      <description>&lt;P&gt;This lead me to my solution - I was not specifying two separate lines to use as boundaries, but rather a selection set that was u-shaped, with the legs of the U intended to be the boundaries. This was how it was working in AutoCAD 2004 with the original code, but AutoCAD 2021 did not appreciate this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem with the selection set is that it was formed using an EXTEND command that extended the legs of the U to the edge of the circle, so I had no actual idea of what those points of intersection were. To get around this, I decided that I would just create arbitrary lines for boundaries and then delete afterward.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I responded to another reply with the full code that I was working with and there were tons of variables that were defined much earlier in the code, so I went and rewrote this portion of code with arbitrary values so I could test it. The code that I ended up getting to work was:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="lisp"&gt;(defun CIRCLE()

(setq pt (list 10 10))
(setq dia 4)
(setq UP (/ pi 2))
(setq RGT 0)
(setq LFT pi)
(setq DWN (/ (* 3 pi) 2))
(command "circle" pt "D" dia)
(setq TRIMMER (ssadd (entlast)))
(setq ang 0)
(setq A (+ ang (* 0.5 pi)))
(setq B (+ ang pi))

(setq P1 (polar pt A 2.5))
(setq P2 (polar P1 B 1))
(setq P3 (polar P1 (+ B pi) 1))
(setq P4 (polar P2 (+ A pi) 0.1))
(setq P5 (polar P3 (+ A pi) 0.1))

(command "pline" P5 P3 P2 P4 "")
(command "EXTEND" TRIMMER "" P4 P5 "")

(setq rpt (list (+ 10 1) 10))
(setq lpt (list (- 10 1) 10))
(command "pline" P5 rpt "")
(setq TEST1 (ssadd (entlast)))
(command "pline" P4 lpt "")
(setq TEST2 (ssadd (entlast)))

(setq nozlpt (polar pt ( + ang (* 0.5 pi)) (* 0.5 dia)))

(command "_.TRIM" TEST2 TEST1 "" nozlpt "")

(command "erase" TEST1 "")
(command "erase" TEST2 "")

)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not sure if this is the absolute fastest way to do this, but it works in the desired way.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for the reply - I didn't even think to check and see if the NOZL selection set was what it didn't like!&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2024 16:08:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-the-trim-command/m-p/12588385#M17261</guid>
      <dc:creator>Abby_Baratta</dc:creator>
      <dc:date>2024-02-28T16:08:49Z</dc:date>
    </item>
    <item>
      <title>Re: Using the Trim Command</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-the-trim-command/m-p/12588398#M17262</link>
      <description>&lt;P&gt;I ended up finding what my issue was - in the original code they were defining NOZL as a U-shaped selection set that was formed using the EXTEND command for the legs of the U. It was using those legs as the boundaries for the trim, but it was being input as one variable, NOZL. AutoCAD did not like this, but I didn't know those intersection points since the EXTEND command didn't need them, so I decided to use arbitrary lines that intersect the circle in the desired place as boundaries and then deleted them after.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I posted the code that I found to fix it in another reply - I rewrote it without all the variable names because I knew what each one was, what it did, and why it was there, so I just put in random numbers for testing.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2024 16:13:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-the-trim-command/m-p/12588398#M17262</guid>
      <dc:creator>Abby_Baratta</dc:creator>
      <dc:date>2024-02-28T16:13:43Z</dc:date>
    </item>
    <item>
      <title>Re: Using the Trim Command</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-the-trim-command/m-p/12588456#M17263</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/15026899"&gt;@Abby_Baratta&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My brain hurts reading your answer&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":face_with_head_bandage:"&gt;🤕&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Isn't the purpose of your TRIM command to remove part of the circle to where the U shape intersects the circle? So it will be (or appear to be) one shape?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you have to create 2 additional lines to trim your circle to (instead of using your U shape lines) then it would sound like the U shape is not adhering to its intended purpose.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While I can agree with the concept of "getting something to just work", it seems a bit far-fetched for this routine since we should already have all of the linework necessary to perform our trim command.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2024 16:30:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-the-trim-command/m-p/12588456#M17263</guid>
      <dc:creator>CodeDing</dc:creator>
      <dc:date>2024-02-28T16:30:19Z</dc:date>
    </item>
    <item>
      <title>Re: Using the Trim Command</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-the-trim-command/m-p/12588520#M17264</link>
      <description>&lt;P&gt;I agree that the u-shaped selection set should work because it was how it was originally written to work and it's much more seamless. Yes, the intent is to trim out the arc underneath the 'u-shape' nozzle. It is intended to look like one shape, as shown below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Abby_Baratta_0-1709138194131.png" style="width: 175px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1331420i08149F3B504EB8E9/image-dimensions/175x188?v=v2" width="175" height="188" role="button" title="Abby_Baratta_0-1709138194131.png" alt="Abby_Baratta_0-1709138194131.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I use the NOZL, it will cut out this shape, but it will give an error that says &lt;STRONG&gt;command: nil&amp;nbsp;&lt;/STRONG&gt;and the rest of my code will not run after it. I will attach a version of the code that makes this shape and cuts out the arc using the NOZL selection set that doesn't depend on all those predefined variables, so it should be easier to work with.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="lisp"&gt;(defun oldcircle()

(setq pt (list 10 10))
(setq dia 4)
(setq UP (/ pi 2))
(setq RGT 0)
(setq LFT pi)
(setq DWN (/ (* 3 pi) 2))
(command "circle" pt "D" dia)
(setq TRIMMER (ssadd (entlast)))
(setq ang 0)
(setq A (+ ang (* 0.5 pi)))
(setq B (+ ang pi))

(setq P1 (polar pt A 2.5))
(setq P2 (polar P1 B 1))
(setq P3 (polar P1 (+ B pi) 1))
(setq P4 (polar P2 (+ A pi) 0.1))
(setq P5 (polar P3 (+ A pi) 0.1))

(command "pline" P5 P3 P2 P4 "")
(setq NOZL (ssadd (entlast)))
(command "EXTEND" TRIMMER "" P4 P5 "")
(setq NOZL (ssadd (entlast)))

(setq nozlpt (polar pt ( + ang (* 0.5 pi)) (* 0.5 dia)))

(command "_.TRIM" NOZL "" nozlpt "")

)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;I would appreciate any help in getting this to now throw the command: nil because this is much simpler than adding in arbitrary lines, just to delete them.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2024 16:50:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-the-trim-command/m-p/12588520#M17264</guid>
      <dc:creator>Abby_Baratta</dc:creator>
      <dc:date>2024-02-28T16:50:30Z</dc:date>
    </item>
    <item>
      <title>Re: Using the Trim Command</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-the-trim-command/m-p/12588638#M17265</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/15026899"&gt;@Abby_Baratta&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I re-wrote your circle code which duplicates the shape and you should be able to easily see where variables could be replaced. Hope this helps:&lt;/P&gt;&lt;LI-CODE lang="lisp"&gt;(defun c:MYSHAPE ( / Circle asin LWPoly pt rad slotWidth slotHeight upDir angDeltaLower angDeltaUpper distUpper cir ptLowerLeft ptUpperLeft ptUpperRight ptLowerRight poly ptTrim)
  ;; ----- Helper Function(s) -----
  ;; Creates a circle on current layer
  ;; cen - point, center of circle
  ;; rad - real/int, radius of circle
  ;; returns - ename, of created circle
  (defun Circle (cen rad)
    (entmakex (list (cons 0 "CIRCLE") (cons 10 cen) (cons 40 rad)))
  )
  ;; Computes asin
  ;; y  = real, -1&amp;lt;=y&amp;lt;=1
  ;; returns - real, inverse sin in radians
  (defun asin (y)
    (atan y (sqrt (- 1 (* y y))))
  )
  ;; Creates polyline on current layer
  ;; lst - list, of points for polyline
  ;; returns - ename, of polyline
  (defun LWPoly (lst)
    (entmakex
      (append
         (list (cons 0 "LWPOLYLINE") (cons 100 "AcDbEntity") (cons 100 "AcDbPolyline")
               (cons 90 (length lst)) (cons 70 0))
         (mapcar (function (lambda (p) (cons 10 p))) lst)
      );append
    );entmakex
  )
  ;; ----- Begin Work -----
  ;; Set default variables &amp;amp; perform geometry for slot info
  (setq pt '(10 10))
  (setq rad 2.0)
  (setq slotWidth 2.0)
  (setq slotHeight 0.5)
  (setq upDir (* 0.5 pi))
  (setq angDeltaLower (asin (/ (* slotWidth 0.5) rad)))
  (setq angDeltaUpper (atan (/ (* slotWidth 0.5) (+ rad slotHeight))))
  (setq distUpper (sqrt (+ (expt (* 0.5 slotWidth) 2) (expt (+ rad slotHeight) 2))))
  ;; Create initial circle
  (setq cir (Circle pt rad))
  ;; Prepare slot locations
  (setq ptLowerLeft (polar pt (+ upDir angDeltaLower) rad))
  (setq ptUpperLeft (polar pt (+ upDir angDeltaUpper) distUpper))
  (setq ptUpperRight (polar pt (- upDir angDeltaUpper) distUpper))
  (setq ptLowerRight (polar pt (- upDir angDeltaLower) rad))
  ;; Create slot
  (setq poly (LWPoly (list ptLowerLeft ptUpperLeft ptUpperRight ptLowerRight)))
  ;; Prep for Trim
  (setq ptTrim (polar pt upDir rad))
  ;; Perform Trim
  (command "_.TRIM" poly "" "non" ptTrim "")
  ;;Finish up
  (prompt "\nMYSHAPE Complete.")
  (princ)
);defun&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2024 17:48:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-the-trim-command/m-p/12588638#M17265</guid>
      <dc:creator>CodeDing</dc:creator>
      <dc:date>2024-02-28T17:48:35Z</dc:date>
    </item>
    <item>
      <title>Re: Using the Trim Command</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-the-trim-command/m-p/12588726#M17266</link>
      <description>&lt;P&gt;&lt;STRONG&gt;YOU SIMPLY NEED TO TURN OFF RUNNING OBJECT SNAP.&lt;/STRONG&gt;&amp;nbsp; Your code in Message 12 fails for me with running Osnap on, but works with it off.&amp;nbsp; It would probably fail in slightly different ways depending on which mode(s) you have on, and even possibly the Zoom level.&amp;nbsp; You should &lt;EM&gt;always build turning that off&lt;/EM&gt; into AutoLisp routines that work with locations in commands in which Osnap can affect things.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2024 18:22:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-the-trim-command/m-p/12588726#M17266</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2024-02-28T18:22:00Z</dc:date>
    </item>
    <item>
      <title>Re: Using the Trim Command</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-the-trim-command/m-p/12588794#M17267</link>
      <description>&lt;P&gt;I tried changing it, but it didn't seem to work and I'm trying to pinpoint why. At the beginning of the code, there is a line that reads&lt;/P&gt;&lt;LI-CODE lang="lisp"&gt;(setvar "OSMODE" 0)&lt;/LI-CODE&gt;&lt;P&gt;Since the code is very lengthy and goes through many LISP routines to get to this point, I went ahead and copied that line and put it right before the section of code that I posed in Message 12.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I type OSNAP into the command line and it brings up the dialog box, the 'Object Snap On' box is checked. I even went into the tools&amp;gt;options&amp;gt;AM:Preferences and changed my OSNAP preference to be off, but this box still checks itself.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am also seeing an invalid window specification when I try and run this code like this:&lt;/P&gt;&lt;LI-CODE lang="lisp"&gt;(setq nozlpt (polar pt ( + ang (* 0.5 pi)) (* 0.5 dia)))

(command "_.TRIM" NOZL "" "non" nozlpt "")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But not when I run it like this:&lt;/P&gt;&lt;LI-CODE lang="lisp"&gt;(setq nozlpt (polar pt ( + ang (* 0.5 pi)) (* 0.5 dia)))

(command "_.TRIM" NOZL "" "non" TRIMMER "")&lt;/LI-CODE&gt;&lt;P&gt;(with the TRIMMER selection set being defined in the code in Message 12)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The only problem with the code that doesn't throw the window specification error is that it trims the whole circle&amp;nbsp;&lt;EM&gt;except for&lt;/EM&gt; the arc underneath the nozzle.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2024 18:46:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-the-trim-command/m-p/12588794#M17267</guid>
      <dc:creator>Abby_Baratta</dc:creator>
      <dc:date>2024-02-28T18:46:14Z</dc:date>
    </item>
    <item>
      <title>Re: Using the Trim Command</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-the-trim-command/m-p/12588828#M17268</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/15026899"&gt;@Abby_Baratta&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;....&lt;/P&gt;
&lt;P&gt;When I type OSNAP into the command line and it brings up the dialog box, the 'Object Snap On' box is checked. ...&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;As for that, it doesn't matter whether it's "on" if &lt;EM&gt;no modes are in effect&lt;/EM&gt; -- that's what an OSMODE setting of zero represents.&amp;nbsp; I don't think it will make any difference, but if you prefer to have no modes selected &lt;EM&gt;and&lt;/EM&gt; to have Osnap "off," set OSMODE to &lt;STRONG&gt;16384&lt;/STRONG&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2024 18:52:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-the-trim-command/m-p/12588828#M17268</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2024-02-28T18:52:28Z</dc:date>
    </item>
    <item>
      <title>Re: Using the Trim Command</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-the-trim-command/m-p/12588884#M17269</link>
      <description>&lt;P&gt;Varioius thoughts....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For me, the code in Message 12 does this [with Osmode = 0]:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Kent1Cooper_0-1709146781345.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1331489i0130722A22514313/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Kent1Cooper_0-1709146781345.png" alt="Kent1Cooper_0-1709146781345.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I work with &lt;EM&gt;Blips turned on&lt;/EM&gt;, so you can see the points it calculates and uses, including the one where it picked the Circle to Trim it between the sides of the top part.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can also see the locations of P4 &amp;amp; P5 where it picked to Extend.&amp;nbsp; I wonder whether those might be so close to the corners that the Zoom level could affect what it "sees" in the Extend command.&amp;nbsp; It may not matter if it's seeing the horizontal segment rather than the vertical end segments, but just in case, does it have the same issues if you Zoom in closer?&amp;nbsp; Or if you set P4 &amp;amp; P5 to be farther from the top?&amp;nbsp; [I'm doubtful, since it works for me.]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Code lines 22 &amp;amp; 24 in Message 12 are redundant -- you don't need to re-establish that variable after Extending.&amp;nbsp; And [again, I'm not sure it will make any difference] the NOZL variable doesn't need it put into a &lt;EM&gt;selection set&lt;/EM&gt;, but can simply use the entity name if it's the only entity involved.&amp;nbsp; Same with TRIMMER in line 10.&amp;nbsp; You could do just:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;(setq NOZL (entlast))&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2024 19:16:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-the-trim-command/m-p/12588884#M17269</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2024-02-28T19:16:53Z</dc:date>
    </item>
    <item>
      <title>Re: Using the Trim Command</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-the-trim-command/m-p/12589550#M17270</link>
      <description>&lt;P&gt;I liked the way the points were worked out so added a front end dcl, added make single pline, added do a rotation on result.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SeaHaven_0-1709169838526.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1331612i410BC42D34DA89E1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SeaHaven_0-1709169838526.png" alt="SeaHaven_0-1709169838526.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;; original code by CODEDING FEB 2024
; Multi getvals added make pline and rotation added by AlanH Feb 2024

(defun c:MYSHAPE ( / Circle asin LWPoly pt rad slotWidth slotHeight upDir angDeltaLower angDeltaUpper 
distUpper cir ptLowerLeft ptUpperLeft ptUpperRight ptLowerRight poly ptTrim oldsnap)
  ;; ----- Helper Function(s) -----
  ;; Creates a circle on current layer
  ;; cen - point, center of circle
  ;; rad - real/int, radius of circle
  ;; returns - ename, of created circle
  (defun Circle (cen rad)
    (entmakex (list (cons 0 "CIRCLE") (cons 10 cen) (cons 40 rad)))
  )
  ;; Computes asin
  ;; y  = real, -1&amp;lt;=y&amp;lt;=1
  ;; returns - real, inverse sin in radians
  (defun asin (y)
    (atan y (sqrt (- 1 (* y y))))
  )
  ;; Creates polyline on current layer
  ;; lst - list, of points for polyline
  ;; returns - ename, of polyline
  (defun LWPoly (lst)
    (entmakex
      (append
         (list (cons 0 "LWPOLYLINE") (cons 100 "AcDbEntity") (cons 100 "AcDbPolyline")
               (cons 90 (length lst)) (cons 70 0))
         (mapcar (function (lambda (p) (cons 10 p))) lst)
      );append
    );entmakex
  )
  ;; ----- Begin Work -----
  ;; Set default variables &amp;amp; perform geometry for slot info
  (setq oldsnap (getvar 'osmode))
  (setvar 'osmode 0)
  
  (setq pt (getpoint "\n Please pick centre point "))
  
  (if (not AH:getvalsm)(load "Multi Getvals.lsp"))
  (setq ans (AH:getvalsm (list "Enter values " "Radius " 5 4 "2" "Slot Width " 5 4 "2" "Slot Height" 5 4 "0.5" "Angle " 5 4 "0")))
  
  (setq rad (atof (nth 0 ans ))
  slotWidth (atof (nth 1 ans))
  slotHeight (atof (nth 2 ans))
  ang (atof (nth 3 ans))
  )
    
  (setq upDir (* 0.5 pi))
  (setq angDeltaLower (asin (/ (* slotWidth 0.5) rad)))
  (setq angDeltaUpper (atan (/ (* slotWidth 0.5) (+ rad slotHeight))))
  (setq distUpper (sqrt (+ (expt (* 0.5 slotWidth) 2) (expt (+ rad slotHeight) 2))))
  ;; Create initial circle
  (setq cir (Circle pt rad))
  
  ;; Prepare slot locations
  (setq ptLowerLeft (polar pt (+ upDir angDeltaLower) rad))
  (setq ptUpperLeft (polar pt (+ upDir angDeltaUpper) distUpper))
  (setq ptUpperRight (polar pt (- upDir angDeltaUpper) distUpper))
  (setq ptLowerRight (polar pt (- upDir angDeltaLower) rad))
  (command "break" ptLowerRight ptLowerLeft ) ; must do right 1st 
  (setq cir (entlast))
  ;; Create slot
  (setq poly (LWPoly (list ptLowerLeft ptUpperLeft ptUpperRight ptLowerRight)))
  (command "pedit" poly "JOIN" cir "" "")
  (if (= ang 0.0)
    (princ)
    (command "rotate" (entlast) "" pt ang)
  )
  ;;Finish up
  (setvar 'osmode oldsnap)
  (prompt "\nMYSHAPE Complete.")
  (princ)
);defun&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SeaHaven_1-1709169974496.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1331613iF469CF12A9656321/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SeaHaven_1-1709169974496.png" alt="SeaHaven_1-1709169974496.png" /&gt;&lt;/span&gt;&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>Thu, 29 Feb 2024 01:26:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-the-trim-command/m-p/12589550#M17270</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2024-02-29T01:26:17Z</dc:date>
    </item>
  </channel>
</rss>

