<?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 Modification for a LISP in AutoCAD Forum</title>
    <link>https://forums.autodesk.com/t5/autocad-forum/modification-for-a-lisp/m-p/12329012#M26662</link>
    <description>&lt;P&gt;Hi guys,&lt;/P&gt;&lt;P&gt;I want slight modification in this LISP&lt;/P&gt;&lt;P&gt;if i gave the command &lt;STRONG&gt;"KK"&lt;/STRONG&gt; the autoCAD asks 1st point then 2nd point at the end a cutline appears but i want a modification. When i give the command the cutline should also appear with a layer&lt;/P&gt;&lt;P&gt;Eg: if I have a Layer named "DETAIL" and if I give the command KK it should&amp;nbsp;ask 1st point then 2nd point at the end a cutline appears that cutline should be in the layer of &lt;STRONG&gt;"DETAIL"&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;(defun c:KK (/ spt1 ept1 d1 ct1 d2 d3 d4 ang1 ang2 ang3 ang4 pt1 pt2 pt3 pt4) ;start of cut&lt;BR /&gt;;(setq sc (getvar "DIMSCALE"));REV 8-14-98&lt;BR /&gt;(setvar "cmdecho" 0)&lt;BR /&gt;(setq spt1(getpoint "\nFirst Cut Point: ")) ;spt1=start pt&lt;BR /&gt;(setq ept1(getpoint spt1 "\nSecond Cut Point: ")) ;ept=end pt&lt;BR /&gt;(setq d1 (distance spt1 ept1)) ;d1=dist start to end pt&lt;BR /&gt;(setq ct1 (/ 10 2)) ;ct1=1/2 scale factor&lt;BR /&gt;(setq ct1 (* 25.4 ct1))&lt;BR /&gt;(setq d2 (/ d1 3)) ;d2=1/3 of d1&lt;BR /&gt;(if (&amp;gt;= d2 ct1) ;if d2 is greater or = ct1&lt;BR /&gt;(progn ; then&lt;BR /&gt;(setq d3 (/ ct1 2)) ;d3=1/4 scale factor&lt;BR /&gt;(setq d2 (- (/ d1 2) d3)) ;d2=dist to start of cut&lt;BR /&gt;) ; end of progn&lt;BR /&gt;(setq d3 (/ d2 2)) ; if not d3=1/6 of d1&lt;BR /&gt;); end of if&lt;BR /&gt;(setq d4 (sqrt (+ (* d3 d3) (* d3 d3)))) ;d4=dist of cut ang&lt;BR /&gt;(setq ang1 (angle spt1 ept1)) ;ang1=ang of start to end pt&lt;BR /&gt;(setq ang2 (angle ept1 spt1)) ;ang2=ang of end to start pt&lt;BR /&gt;(setq ang3 (+ ang1 0.785398)) ;ang3=ang1+45 deg&lt;BR /&gt;(setq ang4 (+ ang3 3.92699)) ;ang4=ang3+225 deg&lt;BR /&gt;(setq pt1 (polar spt1 ang1 d2)) ;pt1=start pt of cut&lt;BR /&gt;(setq pt2 (polar pt1 ang3 d4)) ;pt2=45deg pt&lt;BR /&gt;(setq pt3 (polar pt2 ang4 (* 2 d3))) ;pt3=225deg pt&lt;BR /&gt;(setq pt4 (polar pt3 ang3 d4)) ;pt4=end pt of cut&lt;BR /&gt;(setq spt1 (polar spt1 ang2 d4)) ;spt1=add length to start pt&lt;BR /&gt;(setq ept1 (polar ept1 ang1 d4)) ;ept1=add length to end pt&lt;BR /&gt;(command ".pline" spt1 pt1 pt2 pt3 pt4 ept1 "") ;draw pline&lt;BR /&gt;(command "'redraw") ;clean up&lt;BR /&gt;(reset nil)&lt;BR /&gt;) ;end of cut&lt;/P&gt;</description>
    <pubDate>Wed, 25 Oct 2023 06:00:58 GMT</pubDate>
    <dc:creator>krishravi2000</dc:creator>
    <dc:date>2023-10-25T06:00:58Z</dc:date>
    <item>
      <title>Modification for a LISP</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/modification-for-a-lisp/m-p/12329012#M26662</link>
      <description>&lt;P&gt;Hi guys,&lt;/P&gt;&lt;P&gt;I want slight modification in this LISP&lt;/P&gt;&lt;P&gt;if i gave the command &lt;STRONG&gt;"KK"&lt;/STRONG&gt; the autoCAD asks 1st point then 2nd point at the end a cutline appears but i want a modification. When i give the command the cutline should also appear with a layer&lt;/P&gt;&lt;P&gt;Eg: if I have a Layer named "DETAIL" and if I give the command KK it should&amp;nbsp;ask 1st point then 2nd point at the end a cutline appears that cutline should be in the layer of &lt;STRONG&gt;"DETAIL"&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;(defun c:KK (/ spt1 ept1 d1 ct1 d2 d3 d4 ang1 ang2 ang3 ang4 pt1 pt2 pt3 pt4) ;start of cut&lt;BR /&gt;;(setq sc (getvar "DIMSCALE"));REV 8-14-98&lt;BR /&gt;(setvar "cmdecho" 0)&lt;BR /&gt;(setq spt1(getpoint "\nFirst Cut Point: ")) ;spt1=start pt&lt;BR /&gt;(setq ept1(getpoint spt1 "\nSecond Cut Point: ")) ;ept=end pt&lt;BR /&gt;(setq d1 (distance spt1 ept1)) ;d1=dist start to end pt&lt;BR /&gt;(setq ct1 (/ 10 2)) ;ct1=1/2 scale factor&lt;BR /&gt;(setq ct1 (* 25.4 ct1))&lt;BR /&gt;(setq d2 (/ d1 3)) ;d2=1/3 of d1&lt;BR /&gt;(if (&amp;gt;= d2 ct1) ;if d2 is greater or = ct1&lt;BR /&gt;(progn ; then&lt;BR /&gt;(setq d3 (/ ct1 2)) ;d3=1/4 scale factor&lt;BR /&gt;(setq d2 (- (/ d1 2) d3)) ;d2=dist to start of cut&lt;BR /&gt;) ; end of progn&lt;BR /&gt;(setq d3 (/ d2 2)) ; if not d3=1/6 of d1&lt;BR /&gt;); end of if&lt;BR /&gt;(setq d4 (sqrt (+ (* d3 d3) (* d3 d3)))) ;d4=dist of cut ang&lt;BR /&gt;(setq ang1 (angle spt1 ept1)) ;ang1=ang of start to end pt&lt;BR /&gt;(setq ang2 (angle ept1 spt1)) ;ang2=ang of end to start pt&lt;BR /&gt;(setq ang3 (+ ang1 0.785398)) ;ang3=ang1+45 deg&lt;BR /&gt;(setq ang4 (+ ang3 3.92699)) ;ang4=ang3+225 deg&lt;BR /&gt;(setq pt1 (polar spt1 ang1 d2)) ;pt1=start pt of cut&lt;BR /&gt;(setq pt2 (polar pt1 ang3 d4)) ;pt2=45deg pt&lt;BR /&gt;(setq pt3 (polar pt2 ang4 (* 2 d3))) ;pt3=225deg pt&lt;BR /&gt;(setq pt4 (polar pt3 ang3 d4)) ;pt4=end pt of cut&lt;BR /&gt;(setq spt1 (polar spt1 ang2 d4)) ;spt1=add length to start pt&lt;BR /&gt;(setq ept1 (polar ept1 ang1 d4)) ;ept1=add length to end pt&lt;BR /&gt;(command ".pline" spt1 pt1 pt2 pt3 pt4 ept1 "") ;draw pline&lt;BR /&gt;(command "'redraw") ;clean up&lt;BR /&gt;(reset nil)&lt;BR /&gt;) ;end of cut&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2023 06:00:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/modification-for-a-lisp/m-p/12329012#M26662</guid>
      <dc:creator>krishravi2000</dc:creator>
      <dc:date>2023-10-25T06:00:58Z</dc:date>
    </item>
    <item>
      <title>Re: Modification for a LISP</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/modification-for-a-lisp/m-p/12329102#M26663</link>
      <description>&lt;P&gt;Put that :&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;(command "_change" (entlast) "" "_p" "_layer" "DETAIL" "")&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Before the (command "redraw")&lt;/P&gt;
&lt;P&gt;...should work if the layer exists !&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;(if(tblsearch "layer" "detail")(command "_change" (entlast) "" "_p" "_layer" "detail" ""))&lt;/LI-CODE&gt;
&lt;P&gt;In case you could not be sure&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2023 06:57:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/modification-for-a-lisp/m-p/12329102#M26663</guid>
      <dc:creator>tramber</dc:creator>
      <dc:date>2023-10-25T06:57:50Z</dc:date>
    </item>
  </channel>
</rss>

