<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>AutoCAD Tips Blog &#187; AutoLISP</title>
	<atom:link href="http://www.ellenfinkelstein.com/acadblog/tag/autolisp/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ellenfinkelstein.com/acadblog</link>
	<description>AutoCAD tips &#38; tutorials to help you work faster &#38; smarter</description>
	<lastBuildDate>Sun, 29 Jan 2012 20:18:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Fillets&#8211;another approach using AutoLISP</title>
		<link>http://www.ellenfinkelstein.com/acadblog/fillets-another-approach-using-autolisp/</link>
		<comments>http://www.ellenfinkelstein.com/acadblog/fillets-another-approach-using-autolisp/#comments</comments>
		<pubDate>Wed, 09 Nov 2011 20:50:15 +0000</pubDate>
		<dc:creator>Ellen</dc:creator>
				<category><![CDATA[Drawing]]></category>
		<category><![CDATA[Editing]]></category>
		<category><![CDATA[AutoLISP]]></category>
		<category><![CDATA[fillet]]></category>

		<guid isPermaLink="false">http://www.ellenfinkelstein.com/acadblog/?p=1859</guid>
		<description><![CDATA[
			
				
			
		
<p>Tommy Holder submitted a different approach to creating fillets&#8211;one that includes drawing the lines. For the earlier routine, see &#8220;Reduce mouse clicks and increase productivity with AutoLISP.&#8221;</p>
<p>Tommy&#8217;s approach is unique, I think. Instead of drawing the lines first, the AutoLISP routine prompts you for points, which are the endpoints of the lines. Here are the [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.ellenfinkelstein.com%2Facadblog%2Ffillets-another-approach-using-autolisp%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.ellenfinkelstein.com%2Facadblog%2Ffillets-another-approach-using-autolisp%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Tommy Holder submitted a different approach to creating fillets&#8211;one that includes drawing the lines. For the earlier routine, see &#8220;<a href="http://www.ellenfinkelstein.com/acadblog/reduce-mouse-clicks-and-increase-productivity-using-autolisp/">Reduce mouse clicks and increase productivity with AutoLISP</a>.&#8221;</p>
<p>Tommy&#8217;s approach is unique, I think. Instead of drawing the lines first, the AutoLISP routine prompts you for points, which are the endpoints of the lines. Here are the steps:</p>
<ol>
<li>Download fl.lsp. <a href="http://www.ellenfinkelstein.com/acadblog/wordpress/wp-content/uploads/2011/11/FL.zip">FL.lsp (click to download)</a></li>
<li>Unzip the file.</li>
<li>Use the APPLOAD command to load fl.lsp in a location that is in AutoCAD&#8217;s support file search path.</li>
<li>On the command line, type <strong>fl</strong> and press Enter.</li>
<li>At the Enter points : prompt, specify the first line&#8217;s start point.</li>
<li>The prompt repeats, so specify the first line&#8217;s end point (which is also the second line&#8217;s start point)</li>
<li>Next, specify the second line&#8217;s endpoint and press Enter.</li>
<li>At the Enter BEND RADIUS &lt;1.0000&gt;: prompt, enter the fillet radius and press Enter.</li>
</ol>
<p>Watch the video!</p>
<div id="media"><object id="csSWF" width="640" height="408" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="https://s3.amazonaws.com/ellenfinkelstein.com/website+video+tutorials/autocad-tutorial-videos/fl-autolisp_controller.swf" /><param name="quality" value="best" /><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="true" /><param name="scale" value="showall" /><param name="flashVars" value="autostart=false#&amp;thumb=FirstFrame.png&amp;thumbscale=45&amp;color=0x000000,0x000000" /><param name="allowscriptaccess" value="always" /><param name="allowfullscreen" value="true" /><param name="flashvars" value="autostart=false&amp;thumb=FirstFrame.png&amp;thumbscale=45&amp;color=0x000000,0x000000" /><param name="pluginspage" value="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" /><embed id="csSWF" width="640" height="408" type="application/x-shockwave-flash" src="https://s3.amazonaws.com/ellenfinkelstein.com/website+video+tutorials/autocad-tutorial-videos/fl-autolisp_controller.swf" quality="best" allowScriptAccess="always" allowFullScreen="true" scale="showall" flashVars="autostart=false#&amp;thumb=FirstFrame.png&amp;thumbscale=45&amp;color=0x000000,0x000000" allowscriptaccess="always" allowfullscreen="true" flashvars="autostart=false&amp;thumb=FirstFrame.png&amp;thumbscale=45&amp;color=0x000000,0x000000" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" /> </object></div>
<p>Tommy Holder has 35 years experience with Ingalls Shipbuilding on the Mississippi Gulf Coast where the company has built numerous ships for the Navy. He has been a CAD designer and developer, having written many lines of code, developed many menus, and trained many users. He has been a project lead and supervisor but found that his true calling was not in management but CAD development and helping users.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ellenfinkelstein.com/acadblog/fillets-another-approach-using-autolisp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reduce mouse-clicks and increase productivity using AutoLISP</title>
		<link>http://www.ellenfinkelstein.com/acadblog/reduce-mouse-clicks-and-increase-productivity-using-autolisp/</link>
		<comments>http://www.ellenfinkelstein.com/acadblog/reduce-mouse-clicks-and-increase-productivity-using-autolisp/#comments</comments>
		<pubDate>Mon, 17 Oct 2011 16:20:45 +0000</pubDate>
		<dc:creator>Ellen</dc:creator>
				<category><![CDATA[Customization]]></category>
		<category><![CDATA[Editing]]></category>
		<category><![CDATA[AutoLISP]]></category>
		<category><![CDATA[fillet]]></category>
		<category><![CDATA[productivity]]></category>

		<guid isPermaLink="false">http://www.ellenfinkelstein.com/acadblog/?p=1792</guid>
		<description><![CDATA[
			
				
			
		
<p>This is a guest post by Sanjay Kulkarni, an AutoCAD programmer. You can read more about him at the end of this post.</p>
<p>The number of mouse-clicks required to perform a task is generally a good indicator of productivity. The fewer the number of clicks, the less time required&#8211;hence more productivity.</p>
<p>In this post we will see [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.ellenfinkelstein.com%2Facadblog%2Freduce-mouse-clicks-and-increase-productivity-using-autolisp%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.ellenfinkelstein.com%2Facadblog%2Freduce-mouse-clicks-and-increase-productivity-using-autolisp%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>This is a guest post by Sanjay Kulkarni, an AutoCAD programmer. You can read more about him at the end of this post.</p>
<p>The number of mouse-clicks required to perform a task is generally a good indicator of productivity. The fewer the number of clicks, the less time required&#8211;hence more productivity.</p>
<p>In this post we will see an example of reducing the number of mouse-clicks, and thus improving productivity, using AutoLISP. We will use the example of the FILLET command.</p>
<p>Thanks to one of the blog readers Bruce Newman, who sent a problem to me. It was the source for this post.</p>
<p>The most simple situation where you create a fillet is when two perpendicular lines meet. Inside the FILLET command, you select the two lines (requiring 2 clicks) and AutoCAD creates the fillet.</p>
<p><img class="aligncenter size-full wp-image-1793" title="AlispBlog-1110-Fig1" src="http://www.ellenfinkelstein.com/acadblog/wordpress/wp-content/uploads/2011/10/AlispBlog-1110-Fig1.png" alt="Reducing clicks and increasing productivity in AutoCAD with AutoLISP" width="250" height="497" /></p>
<p>&nbsp;</p>
<p>The equivalent AutoLISP code would be</p>
<p>(command “fillet” (car (entsel “\nSelect the first line: “))(entsel “\nSelect the second line: “)))</p>
<p>This still requires two clicks.</p>
<p>So, the problem now reduces to finding a method to select two lines with a single click.</p>
<p>Before trying in AutoLISP, let’s find out if we can do it manually. There seems to be no option or a work-around to do what we want.</p>
<p>Luckily, we have a single point (the intersection) that is common to both lines. So, let’s explore if we can somehow use the intersection point to select the 2 lines. If you have to click only one point to select multiple objects, obviously it should be the intersection point.</p>
<p>Study of selection methods shows that there are two options that base their selection on two points: crossing &amp; window. Since W must include the objects fully, it won’t be suitable. So let’s try C option.</p>
<p>Use the SELECT command and then the <strong>c</strong> option and click on the intersection point in response to both points. AND …….. Both lines are selected!</p>
<p>The equivalent AutoLISP code would be</p>
<p>(setq ssLines (ssget “c” (setq pt1 (getpoint “\nSelect Intersection: “) ) pt1))</p>
<p>Now I can use each line to create a fillet.</p>
<p>(command “fillet” (ssname ssLines 0) (ssname ssLines 1))</p>
<p>And yes … the fillet appears!</p>
<p><img class="aligncenter size-full wp-image-1795" title="AlispBlog-1110-Fig2" src="http://www.ellenfinkelstein.com/acadblog/wordpress/wp-content/uploads/2011/10/AlispBlog-1110-Fig2.png" alt="Reducing clicks and increasing productivity in AutoCAD using AutoLISP" width="650" height="560" /></p>
<p>&nbsp;</p>
<p>So, here is my simple program:</p>
<p>(defun c:FiletByPt ()</p>
<p>;;; creates fillet by single click</p>
<p>;;; ssk 110918</p>
<p>(setq ssLines (ssget &#8220;c&#8221; (setq pt1 (getpoint &#8220;\nSelect Intersection: &#8220;) ) pt1))</p>
<p>(command &#8220;fillet&#8221; (ssname ssLines 0) (ssname ssLines 1))</p>
<p>)</p>
<p>(prompt &#8220;\nCreates a fillet by single click. Type &#8216;FiletByPt&#8217;&#8221;)</p>
<p><strong>Note:</strong> In the command name above, FiletByPt, &#8220;fillet&#8221; is intentionally spelled &#8220;filet&#8221; to avoid confusion as you start to type the custom AutoLISP command.</p>
<p>To use the above code, copy and paste it into Notepad and save it as filetbypt.lsp in a location that is in AutoCAD&#8217;s support file search path. <a href="http://www.ellenfinkelstein.com/acadblog/how-to-load-an-autolisp-program/">Instructions for loading the program are here.</a></p>
<p>However life is always not so simple. The lines may extend beyond the intersection point. My R&amp;D shows that the above code still works as shown in Fig. 3.</p>
<p><img class="aligncenter size-full wp-image-1796" title="AlispBlog-1110-Fig3" src="http://www.ellenfinkelstein.com/acadblog/wordpress/wp-content/uploads/2011/10/AlispBlog-1110-Fig3.png" alt="AutoCAD tip: Reduce clicks and increase productivity in AutoCAD with AutoLISP" width="420" height="570" /></p>
<p>It even works when the two lines are not perpendicular.</p>
<p>When two lines are selected using a single point, AutoCAD finds and trims shorter segments of each line and then creates a fillet between the two remaining segments.</p>
<p>There might be situations (when two lines meet at the midpoint) where the code may not work or possibly needs modification.</p>
<p>But, if creating fillets is a major task for you, and saving 50% of time can result in significant gain, go ahead and use this code.</p>
<p>Are you stuck-up with such trivial tasks that are strain on your resources? Let me know and we’ll see if I can help you with useful hints or sample code.</p>
<p>Sanjay Kulkarni is an experienced CAD (AutoCAD, Inventor, SolidEdge, CATIA, NX) programmer and a member of the Autodesk Developer Network. He is fluent in AutoLISP, VBA, and VB.NET. He has written for AugiWORLD and Inside AutoCAD. He can be contacted at <a href="mailto:sanganaksakha@gmail.com">sanganaksakha@gmail.com</a></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ellenfinkelstein.com/acadblog/reduce-mouse-clicks-and-increase-productivity-using-autolisp/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Change the font of a text style using AutoLISP</title>
		<link>http://www.ellenfinkelstein.com/acadblog/change-the-font-of-a-text-style-using-autolisp/</link>
		<comments>http://www.ellenfinkelstein.com/acadblog/change-the-font-of-a-text-style-using-autolisp/#comments</comments>
		<pubDate>Sun, 04 Sep 2011 21:48:31 +0000</pubDate>
		<dc:creator>Ellen</dc:creator>
				<category><![CDATA[Customization]]></category>
		<category><![CDATA[Text & Dimensions]]></category>
		<category><![CDATA[AutoLISP]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[text style]]></category>

		<guid isPermaLink="false">http://www.ellenfinkelstein.com/acadblog/?p=1745</guid>
		<description><![CDATA[
			
				
			
		
<p>This is a guest post by Sanjay Kulkarni, an AutoCAD programmer. You can read more about him at the end of this post.</p>
<p>In the current era of globalization, many times you may have to work on drawings received from others. Sometimes, you may not be able to control the quality of the drawings you receive. [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.ellenfinkelstein.com%2Facadblog%2Fchange-the-font-of-a-text-style-using-autolisp%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.ellenfinkelstein.com%2Facadblog%2Fchange-the-font-of-a-text-style-using-autolisp%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p><em>This is a guest post by Sanjay Kulkarni, an AutoCAD programmer. You can read more about him at the end of this post.</em></p>
<p><a href="http://www.ellenfinkelstein.com/acadblog/wordpress/wp-content/uploads/2011/09/autocad_tips-change-font-of-text-style1.png"><img class="alignright size-medium wp-image-1752" title="autocad_tips-change-font-of-text-style" src="http://www.ellenfinkelstein.com/acadblog/wordpress/wp-content/uploads/2011/09/autocad_tips-change-font-of-text-style1-300x136.png" alt="" width="300" height="136" /></a>In the current era of globalization, many times you may have to work on drawings received from others. Sometimes, you may not be able to control the quality of the drawings you receive. In such a situation, you may have to carry out a repair job on the drawings. Such tasks can be made less tedious if you standardize these tasks and carry them out using AutoLISP.</p>
<p>One of my Indian clients receives drawings from their European principals. One of the repair jobs is to change the font of the text inside dimensions, attributes, tables &amp; notes. Since all these texts are included inside their respective block, the task becomes more complicated than is really necessary.</p>
<p>Most of the text, however, is controlled by the text style. Thus, the job is really to change the font in the text style. But there are a handful of the text styles. So, it becomes a time consuming task.</p>
<p>I helped them with a simple AutoLISP function that made this job virtually painless. The function changes the association of a text style from existing font file to another font file. The function takes 2 parameters, the name of the existing text style and the name of the font file that will be associated with the text style.</p>
<p>You can <a href="https://s3.amazonaws.com/ellenfinkelstein.com/chngFontOfTxtStyle.lsp" target="_blank">download the function here</a>.</p>
<h3>How to use the AutoLISP function</h3>
<p>This function can be used like this:</p>
<p>(chngFontOfTxtStyle &#8220;&lt;TextStyleName&gt;&#8221; &#8220;&lt;DifferentFont.xtn&gt;&#8221;)</p>
<p>As you may have noticed, this function can be used only inside another AutoLISP program. This calling AutoLISP program can provide the user interface that you may need. Following are a couple of sample situations that you can build around this function.</p>
<p>1. Ask the user to type the names of the text style and font file and store them in variables. Call the above function with these two variables as parameters.</p>
<p>2. Ask the user to type the name of the font file. Browse programmatically through all the text styles and repeatedly call the above function with name of each text style and name of the font file as parameters. This will change the font of all text styles.</p>
<p>As you can see, there is no limit to the situations you can build and keep using the function.</p>
<p>For example, you could enter the following on the command line:</p>
<p>(chngFontOfTxtStyle &#8220;Something Funny&#8221; &#8220;arial.ttf&#8221;)</p>
<p>In this case, the name of the text style is Something Funny and you want to change the font to Arial.</p>
<h3>How to get help for the function</h3>
<p>Also note that this function has built in help. The message is displayed as soon as you load the lisp file to type<strong> cfot?</strong> (note the use of ? to indicate help) at the command prompt. If you type this, minimal help is displayed at the command prompt.</p>
<p>How do you know that the font name association was successfully changed? As described in help, the function returns 0 if successful or -1 if not. You will need to check the return value.</p>
<h3>What other tasks do you want to automate?</h3>
<p>Are you stuck-up with such trivial tasks that are strain on your resources. Let me know directly (my email is below) and we’ll see if I can help you with useful hints or sample code. Or you can post a comment.</p>
<p><em><a href="http://www.linkedin.com/in/sanjaykulkarnipune" target="_blank">Sanjay Kulkarni</a> is an experienced CAD (AutoCAD, Inventor, SolidEdge, CATIA, NX) programmer and a member of the Autodesk Developer Network. He is fluent in AutoLISP, VBA, and VB.NET. He has written for AugiWORLD and Inside AutoCAD (a monthly magazine that has since gone out of publication). He can be contacted at<a href="mailto:sanganaksakha@gmail.com"> sanganaksakha@gmail.com</a></em></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ellenfinkelstein.com/acadblog/change-the-font-of-a-text-style-using-autolisp/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Understanding how dimensions are associated with objects</title>
		<link>http://www.ellenfinkelstein.com/acadblog/understanding-how-dimensions-are-associated-with-objects/</link>
		<comments>http://www.ellenfinkelstein.com/acadblog/understanding-how-dimensions-are-associated-with-objects/#comments</comments>
		<pubDate>Sat, 06 Aug 2011 21:34:23 +0000</pubDate>
		<dc:creator>Ellen</dc:creator>
				<category><![CDATA[Customization]]></category>
		<category><![CDATA[Text & Dimensions]]></category>
		<category><![CDATA[associativity]]></category>
		<category><![CDATA[AutoLISP]]></category>
		<category><![CDATA[dimensions]]></category>
		<category><![CDATA[reactors]]></category>

		<guid isPermaLink="false">http://www.ellenfinkelstein.com/acadblog/?p=1713</guid>
		<description><![CDATA[
			
				
			
		
<p></p>
<p>This is a guest post by Sanjay Kulkarni, an AutoCAD programmer.</p>
<p>Learning AutoLISP (or any other programming language) doesn’t compel  you to become a programmer. You can still use it to better understand  the internal working of AutoCAD and enhance your interactive working  skill. This can also give you an edge over others.</p>
<p>Recently [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.ellenfinkelstein.com%2Facadblog%2Funderstanding-how-dimensions-are-associated-with-objects%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.ellenfinkelstein.com%2Facadblog%2Funderstanding-how-dimensions-are-associated-with-objects%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p><img class="alignright size-medium wp-image-1714" title="autocad_tips-dimensions-objects-1" src="http://www.ellenfinkelstein.com/acadblog/wordpress/wp-content/uploads/2011/08/autocad_tips-dimensions-objects-1-300x219.PNG" alt="autocad_tips-dimensions-objects-1" width="300" height="219" /></p>
<p>This is a guest post by Sanjay Kulkarni, an AutoCAD <span id="IL_AD12">programmer</span>.</p>
<p>Learning AutoLISP (or any other programming language) doesn’t compel  you to become a programmer. You can still use it to better understand  the internal working of AutoCAD and enhance your interactive working  skill. This can also give you an edge over others.</p>
<p>Recently I received a client’s drawing that was in AutoCAD 2004. Even  when I saved it in AutoCAD 2010, the dimension would not adjust when I  changed the length of a line. Only after I recreated the dimension was I  able to use this capability. The reason, I found, was that the  dimension in AutoCAD 2004 did not have the reactor (discussed below).  Only when I created the dimension in AutoCAD 2010 was the reactor added.</p>
<h3>Let’s learn this lesson with an example</h3>
<p>Everybody knows that when you dimension an object, the dimension  automatically updates when you modify the object. Have you ever wondered  how the dimension knows it has to update? AutoLISP can help you find  this out, if you don’t already  know.</p>
<p>Here’s the example:</p>
<p>1. Draw a line.</p>
<p>2. Get its entity list by typing the following piece of AutoLISP code at the command prompt:</p>
<p>(entget (car (entsel)))</p>
<p>and selecting the line when prompted to select an object. You’ll see  something similar to the following at the command line in return.</p>
<p>((-1 . &lt;Entity name: 7ee45a18&gt;) (0 . “LINE”) (330 . &lt;Entity  name: 7ee43cf8&gt;) (5 . “22B”) (100 . “AcDbEntity”) (67 . 0) (410 .  “Model”) (8 . “0″) (100 . “AcDbLine”) (10 10.0 10.0 0.0) (11 160.0 160.0  0.0) (210 0.0 0.0 1.0))</p>
<p>This, you might have guessed, is the record that AutoCAD stores in its database.</p>
<p>3. Create a dimension (aligned for example) to show the length of the  line and get the entity list of the line again. You should get a result  similar to:</p>
<p>((-1 . &lt;Entity name: 7ee45a18&gt;) (0 . “LINE”) (5 . “22B”) <strong>(102 . “{ACAD_REACTORS”) (330 . &lt;Entity name: 7ee45ae8&gt;) (102 . “}”)</strong> (330 . &lt;Entity name: 7ee43cf8&gt;) (100 . “AcDbEntity”) (67 . 0)  (410 . “Model”) (8 . “0″) (100 . “AcDbLine”) (10 10.0 10.0 0.0) (11  160.0 160.0 0.0) (210 0.0 0.0 1.0))</p>
<p>You might have noticed a new item starting with (102 .  “{ACAD_REACTORS”) (330 . &lt;Entity name: 7ee45ae8&gt;) (102 . “}”) in  the entity list of the line.</p>
<p>This is a reference to a reactor object that AutoCAD has created  after adding the dimension. This reactor ensures that dimension gets  modified when the object (line in this case) gets modified.</p>
<p>A <strong>reactor </strong>is a program that executes automatically  when a particular action (change in the length of line in this case) is  completed. A reactor executes only AFTER an editing action is completed.  Hence, you see that the dimension is modified after the command that  modifies the line completes and is not dynamically updated while length  of line is being modified.</p>
<p>4. Next, entget the dimension using the same code but selecting the dimension this time.  You will get something similar to:</p>
<p>((-1 . &lt;Entity name: 7ee45a20&gt;) (0 . “DIMENSION”) (5 . “22C”)  (102 . “{ACAD_XDICTIONARY”) (360 . &lt;Entity name: 7ee45a90&gt;) (102 .  “}”) <strong>(102 . “{ACAD_REACTORS”) (330 . &lt;Entity name: 7ee45ae8&gt;) (102 . “}”)</strong> (330 . &lt;Entity name: 7ee43cf8&gt;) (100 . “AcDbEntity”) (67 . 0)  (410 . “Model”) (8 . “0″) (100 . “AcDbDimension”) (280 . 0) (2 . “*D6″)  (10 173.511 146.489 0.0) (11 98.5106 71.4894 0.0) (12 0.0 0.0 0.0) (70 .  33) (1 . “”) (71 . 5) (72 . 1) (41 . 1.0) (42 . 212.132) (73 . 0) (74 .  0) (75 . 0) (52 . 0.0) (53 . 0.0) (54 . 0.0) (51 . 0.0) (210 0.0 0.0  1.0) (3 . “Standard”) (100 . “AcDbAlignedDimension”) (13 10.0 10.0 0.0)  (14 160.0 160.0 0.0) (15 0.0 0.0 0.0) (16 0.0 0.0 0.0) (40 . 0.0) (50 .  0.0))</p>
<p>You will notice that exactly same reactor appears in the entity list  of dimension. Thus, this reactor is the link between the line and  dimension.</p>
<p>5. Add one more dimension to the line and get the entity list of line  once more. You will see one more item with (330 . in the reactor  reference. Thus each dimension associated with line is added as an item  with 330 dxf code in the entity list of line..</p>
<p>6. Now delete one of the dimensions and get the new entity list of  the line. You will find that one of the (330 . item has been removed.</p>
<p>7. After you delete all dimensions, the entity list of the line returns to its original form without any (102 . items.</p>
<h3>A possibility to improve associativity</h3>
<p>It is interesting to note that when object is deleted, dimension does  not get deleted. Thus it lacks true associativity with the object.</p>
<p>You could create a situation whereby the dimension would be deleted  when the object was deleted by adding a reference to one more reactor in  the dimension’s entity list that responds to deleting its associated  object, but you would have to write code to do so.</p>
<p>Sanjay Kulkarni is an experienced CAD (AutoCAD, Inventor, SolidEdge, CATIA, NX) programmer  and a member of the Autodesk Developer Network. He is fluent in  AutoLISP, VBA, and VB.NET. He has written for AugiWORLD and Inside AutoCAD (a monthly magazine that has since gone out of publication). You can contact him at <a href="mailto:sanganakskha@gmail.com">sanganakskha@gmail.com.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ellenfinkelstein.com/acadblog/understanding-how-dimensions-are-associated-with-objects/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>How to load an AutoLISP program</title>
		<link>http://www.ellenfinkelstein.com/acadblog/how-to-load-an-autolisp-program/</link>
		<comments>http://www.ellenfinkelstein.com/acadblog/how-to-load-an-autolisp-program/#comments</comments>
		<pubDate>Tue, 05 Jul 2011 13:30:17 +0000</pubDate>
		<dc:creator>Ellen</dc:creator>
				<category><![CDATA[Customization]]></category>
		<category><![CDATA[AutoLISP]]></category>
		<category><![CDATA[load]]></category>

		<guid isPermaLink="false">http://www.ellenfinkelstein.com/acadblog/?p=1374</guid>
		<description><![CDATA[
			
				
			
		
<p>This is a guest post by Sanjay Kulkarni, an AutoCAD programmer.</p>
<p>This post describes the method to load an AutoLISP program in an open drawing.</p>
Some basic &#38; fundamental information before we move to the procedure
<p>An AutoLISP program runs inside (in the same workspace of) an open drawing. Therefore it is necessary to load the program in [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.ellenfinkelstein.com%2Facadblog%2Fhow-to-load-an-autolisp-program%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.ellenfinkelstein.com%2Facadblog%2Fhow-to-load-an-autolisp-program%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>This is a guest post by Sanjay Kulkarni, an AutoCAD programmer.</p>
<p>This post describes the method to load an AutoLISP program in an open drawing.</p>
<h3>Some basic &amp; fundamental information before we move to the procedure</h3>
<p>An AutoLISP program runs inside (in the same workspace of) an open drawing. Therefore it is necessary to load the program in each individual drawing you want to use the program in. You can load a program into a drawing at any time.</p>
<p>Once you load the program in a drawing, it remains loaded into that specific drawing until the drawing is closed.  This means that you can use the functions in the program multiple times once you load the program.</p>
<p>The flip side is that you can&#8217;t unload an AutoLISP program once you load it except by closing the drawing.</p>
<p>If you want to use the same program in multiple drawings, you will need to load the program in each individual drawing even if there exists a drawing in which the program has been already loaded.</p>
<h3>Loading an AutoLISP program</h3>
<p>Now to the action:</p>
<ol>
<li> Type appload at the command prompt (In AutoCAD 2012, you can go to Manage tab&gt;Applications panel&gt;Load Application.). This will display the Load/Unload Applications dialog box as shown below.</li>
</ol>
<p><img class="aligncenter size-full wp-image-184" title="load-applications-dialog-box" src="http://womenwithwebsites.org/wp-content/uploads/2011/07/load-applications-dialog-box1.png" alt="" width="568" height="583" /></p>
<ol>
<li>Click the History List tab at the bottom of the dialog box. In case the program was previously loaded in any drawing with Add to History checked, it will be listed there. Select the desired file in the list and go to step 7. Otherwise, go to step 3.</li>
<li>Make sure that Files of type displays the .lsp extension.</li>
<li>Using the LookIn drop-down, you browse to the desired location (folder).</li>
<li>If you want to be able to use step 2 above in future, select the Add to History checkbox.</li>
<li> Select the .lsp file to load in the window.</li>
<li>Click Load. If the file is successfully loaded, a message to that effect is displayed at the bottom of the dialog box. Also if you have checked Add to History, the names of loaded programs are added to in the History List tab of the window.</li>
<li>Click the Close button to close the dialog box.</li>
</ol>
<p>You are now ready to use the functions in the loaded files.</p>
<p><strong>Notes:</strong></p>
<ul>
<li>You can select multiple files in the History List or the browser using Shift &amp; Control keys and then click the Load button to load all the selected files simultaneously.</li>
<li>You can double-click on an individual file to both select and load it. Then you don’t need to click the Load button.</li>
<li>When you double-click on a file in History List with Add to History checked, the file name is added again to the History List. You can remove filenames in the History List by selecting the file and clicking the Remove button.</li>
<li>If you load a file multiple times in a drawing, AutoCAD does not generate any error and overwrites the previous version of the loaded file.</li>
</ul>
<p>For a quicker method of loading a program, see the tip, “<a href="http://www.ellenfinkelstein.com/acadblog/loading-autolisp-programs-quickly/">Loading AutoLISP programs quickly</a>.&#8221;  This will also obviate the need to load program in each drawing.</p>
<p>Sanjay Kulkarni is an experienced CAD (AutoCAD, Inventor, SolidEdge, CATIA, NX) programmer and a member of the Autodesk Developer Network. He is fluent in AutoLISP, VBA, and VB.NET. He has written for AugiWORLD and Inside AutoCAD (a monthly magazine that has since gone out of publication). You can contact him at <a href="mailto:sanganakskha@gmail.com">sanganakskha@gmail.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ellenfinkelstein.com/acadblog/how-to-load-an-autolisp-program/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Another way to align a rectangle with a line on the fly&#8211;using AutoLISP</title>
		<link>http://www.ellenfinkelstein.com/acadblog/another-way-to-align-a-rectangle-with-a-line-on-the-fly/</link>
		<comments>http://www.ellenfinkelstein.com/acadblog/another-way-to-align-a-rectangle-with-a-line-on-the-fly/#comments</comments>
		<pubDate>Thu, 02 Jun 2011 01:22:46 +0000</pubDate>
		<dc:creator>Ellen</dc:creator>
				<category><![CDATA[Customization]]></category>
		<category><![CDATA[Drawing]]></category>
		<category><![CDATA[AutoLISP]]></category>
		<category><![CDATA[rectangle]]></category>
		<category><![CDATA[rotate]]></category>

		<guid isPermaLink="false">http://www.ellenfinkelstein.com/acadblog/?p=937</guid>
		<description><![CDATA[
			
				
			
		
<p>This is a guest post by Sanjay Kulkarni, an AutoCAD programmer. You can read more about him at the end of this post.</p>
<p>In an earlier post, Ellen showed how to align a rectangle with a line on the fly. You can easily create the same effect using AutoLISP. This AutoLISP routine is simple, and you [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.ellenfinkelstein.com%2Facadblog%2Fanother-way-to-align-a-rectangle-with-a-line-on-the-fly%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.ellenfinkelstein.com%2Facadblog%2Fanother-way-to-align-a-rectangle-with-a-line-on-the-fly%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>This is a guest post by Sanjay Kulkarni, an AutoCAD programmer. You can read more about him at the end of this post.</p>
<p><a href="http://www.ellenfinkelstein.com/acadblog/align-a-rectangle-with-a-line-on-the-fly/" target="_self">In an earlier post, Ellen showed how to align a rectangle with a line on the fly</a>. You can easily create the same effect using AutoLISP. This AutoLISP routine is simple, and you can use the code as a starting point for your own routines.</p>
<p>First, Ellen has created a video to show you how this works.</p>
<div id="media"><object id="csSWF" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="640" height="418" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="https://s3.amazonaws.com/ellenfinkelstein.com/website+video+tutorials/align-rectangle-with-line-autolisp_controller.swf" /><param name="bgcolor" value="#1a1a1a" /><param name="quality" value="best" /><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="true" /><param name="scale" value="showall" /><param name="flashVars" value="autostart=false#&amp;thumb=FirstFrame.png&amp;thumbscale=45&amp;color=0x000000,0x000000" /><param name="name" value="csSWF" /><param name="flashvars" value="autostart=false&amp;thumb=FirstFrame.png&amp;thumbscale=45&amp;color=0x000000,0x000000" /><param name="allowfullscreen" value="true" /><embed id="csSWF" type="application/x-shockwave-flash" width="640" height="418" src="https://s3.amazonaws.com/ellenfinkelstein.com/website+video+tutorials/align-rectangle-with-line-autolisp_controller.swf" name="csSWF" flashvars="autostart=false&amp;thumb=FirstFrame.png&amp;thumbscale=45&amp;color=0x000000,0x000000" scale="showall" allowfullscreen="true" allowscriptaccess="always" quality="best" bgcolor="#1a1a1a"></embed></object></div>
<p>Here are the steps to use this AutoLISP routine:</p>
<ol>
<li><a href="https://s3.amazonaws.com/ellenfinkelstein.com/RectAlinM.lsp" target="_self">Download the AutoLISP file</a>. You need to do this only once, of course.</li>
<li>Start the APPLOAD command. In AutoCAD 2012, you can go to Manage tab&gt;Applications panel&gt;Load Application.</li>
<li>In the Load/Unload Application dialog box, make sure that the Files of Type drop-down list displays the .lsp extension. In the Look In box, navigate to the AutoLISP file and select it.</li>
<li>Click the Load button. You should see a message at the bottom of the dialog box saying that the file was successfully loaded.</li>
<li>Click Close to close the dialog box. For a quicker method of loading a program, see my tip, &#8220;<a title="Permanent Link: Loading AutoLISP programs quickly" href="http://www.ellenfinkelstein.com/acadblog/loading-autolisp-programs-quickly/" target="_self">Loading AutoLISP programs quickly</a>&#8220;.</li>
<li>Draw a diagonal line in your drawing.</li>
<li>On the command line, type <strong>ra </strong>and press Enter.</li>
<li>Follow the prompts. At the <strong>Select the line to align rectangle with:</strong> prompt, select the line  	to align the rectangle with. The program repeats the prompt until you select  	a line or press the Escape key to abort the program.</li>
<li>At the<strong> Specify first corner point or  	[Chamfer/Elevation/Fillet/Thickness/Width]:</strong> prompt, specify the  	first corner of the rectangle. You can now see that the rectangle is aligned with the line.</li>
<li>At the <strong>Specify other corner point or [Area/Dimensions/Rotation]:</strong> prompt,  	specify the other corner of the rectangle to finish 	<span id="IL_AD4">the routine</span><span id="IL_AD4"> and  	create a rectangle aligned with the selected line.<br />
</span></li>
</ol>
<p><strong>Tip: </strong>You can repeat the command in the drawing as long as the drawing is  	open. But if you open another drawing you will need to reload the program. To avoid having to do this, you can add it to your Startup Suite. In the Load/Unload Application dialog box, drag the AutoLISP file from the list of files at the top to the Startup Suite in the lower-right section of the dialog box.</p>
<p>I won&#8217;t show you the actual code in all my posts, but this one is simple enough that it will be useful to look at its structure. As I said, you can use this same structure for many situations. It&#8217;s similar to a script file; you are using the COMMAND function to execute an AutoCAD command. The code also defines an alias, RA. The PAUSE function waits for your input. Of course, the code also defines some variables, does some error checking, sets up the prompts, and a little more.</p>
<p>(defun RectAlin ()<br />
(setq oOSMODE (getvar &#8220;osmode&#8221;))<br />
(setvar &#8220;osmode&#8221; 0)<br />
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<br />
;;; selecting the line<br />
(setq theLine nil)<br />
(while (= theLine nil)<br />
(setq theLine<br />
(car<br />
(entsel<br />
&#8220;\nSelect the line to align rectangle with [Escape to cancel]:&#8221;<br />
)<br />
)<br />
)<br />
(setq eLstLine (entget theLine))<br />
(if (/= (cdr (assoc 0 eLstLine)) &#8220;LINE&#8221;)<br />
(setq theLine nil)<br />
)<br />
)<br />
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<br />
(setq sPt (cdr (assoc 10 eLstLine)))<br />
(setq ePt (cdr (assoc 11 eLstLine)))<br />
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<br />
;;; Create aligned rectangle<br />
(command &#8220;rectang&#8221; PAUSE &#8220;R&#8221; &#8220;P&#8221; sPt ePt PAUSE)<br />
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<br />
(setvar &#8220;osmode&#8221; oOSMODE)<br />
(princ)<br />
)<br />
(defun c:RA ()<br />
(RectAlin)<br />
)</p>
<p>Do you use AutoLISP in this way? Let us know how you use simple routines like this in your work&#8211;leave a comment!</p>
<p><a href="http://www.linkedin.com/in/sanjaykulkarnipune" target="_blank">Sanjay Kulkarni</a> is an experienced CAD (AutoCAD, Inventor, SolidEdge, CATIA, NX) programmer and a member of the Autodesk Developer Network. He is fluent in AutoLISP, VBA, and <a href="http://vb.net/">VB.NET</a>. He has written for AugiWORLD and Inside AutoCAD (a monthly magazine that has since gone out of publication). He can be contacted at <a href="mailto:sanganakskha@gmail.com">sanganakskha@gmail.com</a><br />
<!--INFOLINKS_ON--></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ellenfinkelstein.com/acadblog/another-way-to-align-a-rectangle-with-a-line-on-the-fly/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Productivity boost ideas</title>
		<link>http://www.ellenfinkelstein.com/acadblog/productivity-boost-ideas/</link>
		<comments>http://www.ellenfinkelstein.com/acadblog/productivity-boost-ideas/#comments</comments>
		<pubDate>Tue, 22 Sep 2009 15:47:33 +0000</pubDate>
		<dc:creator>Ellen</dc:creator>
				<category><![CDATA[Customization]]></category>
		<category><![CDATA[AutoLISP]]></category>
		<category><![CDATA[productivity]]></category>
		<category><![CDATA[shortcuts]]></category>

		<guid isPermaLink="false">http://www.ellenfinkelstein.com/acadblog/?p=62</guid>
		<description><![CDATA[
			
				
			
		
<p>Note: This is an article by Fran Golding, Senior Drafter at Parsons Brinckerhoff, a large planning, environment and infrastructure firm with offices in Australia and New Zealand. Perhaps you can add your own productivity boost ideas.</p>
<p>When I first started to drive a car, I had the feeling that I was not the one in control. [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.ellenfinkelstein.com%2Facadblog%2Fproductivity-boost-ideas%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.ellenfinkelstein.com%2Facadblog%2Fproductivity-boost-ideas%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p><em>Note: This is an article by Fran Golding, Senior Drafter at Parsons Brinckerhoff, a large planning, environment and infrastructure firm with offices in Australia and New Zealand. Perhaps you can add your own productivity boost ideas.</em></p>
<p>When I first started to drive a car, I had the feeling that I was not the one in control. The car was controlling me. It took some</p>
<div class="wp-caption alignright" style="width: 346px"><img title="Out of control" src="http://www.ellenfinkelstein.com/autocadtips/images/acadtips_productivity_boost-3.jpg" alt="Out of control" width="336" height="252" /><p class="wp-caption-text">Out of control</p></div>
<p>time and practice before that changed. Likewise, when I started to use AutoCAD, I had the same feeling. All sorts of things happened which I did not understand. With time and practice (quite a lot of time and practice, I might add), that changed. As with driving a car, I did the same functions, the same way in which I was taught. It wasn’t until I had more confidence in what I was doing that I branched out and tried new ways of doing things. Thence came the beginning of my productivity boost!</p>
<p>Unlike driving a car, AutoCAD performs the same functions in many different ways. You can start the PLOT command by typing plot at the command line, choosing a toolbar or ribbon icon, or choosing File&gt; Print from the drop-down menu (with variations depending on your release and workspace). Any of these will perform the same result. When you are first learning to “drive” AutoCAD, chances are you will generally follow the exact method which you were taught. It’s not until you understand how the program works that you can speed up what you do by creating shortcuts.</p>
<p>I am always surprised to find that users with many years experience still perform functions the long way. Often it depends on what (or who) they have been exposed to at their jobs. It rings true for any trade – if you have an innovative mentor, you will be more innovative! With the technological information super highway we have so much information at our finger tips. There is just no need to plod along doing the same things, the same way, year after year, after year!</p>
<p>“How much difference can it make?” I hear you asking. If we measure key strokes performed in a day, then reduce them by only one key stroke, it compounds to a staggering saving in a year.</p>
<p>To increase your productivity, you don’t need to reinvent the wheel. If you don’t know where to start and you don’t have a resident CAD guru in your office, don’t despair! An Internet search will return countless results. Don’t be put off. Start your journey with that one step. It will lead to the next in a very short time.</p>
<h3>Create aliases</h3>
<p>The very first step which I took was to add some command aliases to my ACAD.PGP file. Aliases allow you to type one letter at the command line instead of the full word, such as E for Erase, C for Copy or M for Move. They cut out many key strokes. <strong>Editors note:</strong> In AutoCAD 2010, go to Manage tab&gt; Customization panel&gt; Edit Aliases to customize acad.pgp. You can also open acad.pgp from Windows in a text editor; its location varies according to your release and Windows version.</p>
<div class="wp-caption aligncenter" style="width: 331px"><img title="Part of the acad.pgp file" src="http://www.ellenfinkelstein.com/autocadtips/images/acadtips_productivity_boost-2.png" alt="Part of the acad.pgp file" width="321" height="440" /><p class="wp-caption-text">Part of the acad.pgp file</p></div>
<h3>Write simple AutoLISP routines</h3>
<p>The next step which I took was to write some very simple AutoLISP routines. I began my own AutoLISP file which I added to the Startup Suite. This means you do not need to load the routines individually each time you start AutoCAD. <strong>Editors note:</strong> To add a .lsp file to the Startup Suite, use the APPLOAD command. In the Load/Unload Applications dialog box, locate the file and drag it to the Startup Suite icon.</p>
<div class="wp-caption aligncenter" style="width: 275px"><img title="Drag AutoLISP files to the Startup Suite" src="http://www.ellenfinkelstein.com/autocadtips/images/acadtips_productivity_boost-1.png" alt="Drag AutoLISP files to the Startup Suite" width="265" height="269" /><p class="wp-caption-text">Drag AutoLISP files to the Startup Suite</p></div>
<p>Some examples of these very simple routines are getting distance measurements with selected object snaps. For example, I sometimes need to obtain a distance nearest an object or line, then perpendicular to an object or line. The coding for this looks like: <span class="prompt">(defun C:DNP () (command “DIST” “NEA” pause “PER”))</span></p>
<p>Then, typing DNP at the command line allows me get the information I need. You might say that you can easily set OSNAPS and achieve the same thing, but the above coding ensures that the correct object snap is used every time. This can often be critical.</p>
<p><strong>Editor&#8217;s note:</strong> The syntax is <span class="prompt">(defun C:[name] () (command &#8220;DIST&#8221; &#8220;[osnap]&#8221; pause &#8220;[osnap]&#8220;))</span> where <span class="prompt">[name]</span> is the name of the custom command you are creating and what you type to execute it and <span class="prompt">[osnap]</span> is any object snap you want to use. The pause command stops the execution of the routine for user input, in this case, specifying a point.</p>
<p>From here there are many more such command combinations that you can write using the same syntax, and substituting different object snaps, such as:</p>
<ul>
<li>DII (distance from intersection to intersection):<br />
<span class="prompt">(defun C:Dii () (command “DIST” “INTERSECTION” pause “INTERSECTION”))</span></li>
<li>DEE (distance from endpoint to endpoint)<br />
<span class="prompt">(defun C:DEE () (command “DIST” “ENDPOINT” pause “ENDPOINT”))</span></li>
<li>DEP (distance from endpoint to perpendicular)<br />
<span class="prompt">(defun C:DEP () (command “DIST” “ENDPOINT” pause “PERPENDICULAR”))</span></li>
</ul>
<p>Likewise, you can write many AutoLISP routines to draw lines using selected object snaps:</p>
<ul>
<li>LINE command from Nearest, then Perpendicular to an object or line:<br />
<span class="prompt">(defun C:LNP () (command “LINE” “NEA” pause “PER”))</span></li>
<li>LEE (line from endpoint to endpoint):<br />
<span class="prompt">(defun C:LEE () (command “LINE” “ENDPOINT” pause “ENDPOINT”))</span></li>
<li>LME (line midpoint to endpoint):<br />
<span class="prompt">(defun C:LME () (command “LINE” “MIDPOINT” pause “ENDPOINT”))</span></li>
</ul>
<p><strong>Editor&#8217;s note: </strong>Here, the syntax is similar, but uses the LINE command instead of the DIST command.</p>
<p>Once you start writing these, you can easily add others. Even slightly more complex AutoLISP <ins datetime="2009-08-30T16:27" cite="mailto:ellen"> </ins>routines will become easy to write. For example, you can write AutoLISP routines to change system variables such as turning wipe out frames on or off.</p>
<ul>
<li>To turn wipe out frames on:<br />
<span class="prompt">(defun C:WF1 () (command &#8220;WIPEOUT&#8221; &#8220;FRAME&#8221; “ON&#8221;))</span></li>
<li>To turn wipe out frames off:<br />
<span class="prompt">(defun C:WF01 () (command &#8220;WIPEOUT&#8221; &#8220;FRAME&#8221; &#8220;OFF&#8221;))</span></li>
</ul>
<p>If you look closely at the coding, you will notice that the text inside the inverted commas [quotation marks] is what you would normally type at the command line.</p>
<p>Another series of handy AutoLISP routines is creating frequently used layers, setting their colour and setting them to current. For example, the company I work for specifies that all dimensions are drawn on a layer called “DIMS” which has the color 2 (yellow). The AutoLISP to create this layer looks like: <span class="prompt">(defun C:D2 () (command “-LAYER” “N” “DIMS” “S” “DIMS” “C” “2” “”))</span></p>
<p>You can then write extras to add many more layers such as a layer to draw hatches would look exactly the same as for DIMS with the appropriate substitutes. For example: <span class="prompt">(defun C:H2 () (command “-LAYER” “N” “HATCHES” “S” “DIMS” “C” “2” “”))</span></p>
<p>My company also has a dedicated layer for inserting external reference drawings called XREF. So, the code to create this and set it current looks like: <span class="prompt">(defun C:X2 () (command “-LAYER” “N” “XREF” “S” “DIMS” “C” “2” “”))</span></p>
<p>Here are some more of my favourites:</p>
<ul>
<li>To lock or unlock viewports:<br />
<span class="prompt">(defun C:V0 () (command  “MVIEW”      “LOCK” “OFF” pause “”))<br />
(defun C:V1 () (command  “MVIEW”      “LOCK” “ON” pause “”))</span></li>
<li>To fillet lines using a zero radius:<br />
<span class="prompt">(defun C:F0 () (command  “FILLET”      “R” “0”) (command “FILLET”))</span></li>
<li>To fillet using a supplied radius:<br />
<span class="prompt">(defun C:FR () (setq rad (getstring “\n Enter Radius:”))<br />
(command  “FILLET” “R” rad)<br />
(command      “FILLET” pause pause)<br />
(princ))</span></li>
</ul>
<p><strong>Editor&#8217;s note:</strong> This last routine uses the setq AutoLISP command to set a variable named rad to the result of user input in response to the Enter Radius: prompt. It then uses the result to set the fillet radius.</p>
<p>The key to successfully boosting your productivity is to keep on learning. You will be surprised how much greater satisfaction you will get out of increasing your learning. Greater productivity leads to a win-win situation. Your employer will be pleased, and who knows — that may lead to greater remuneration. In this article, I want to encourage all users to embrace the latest and strive to be more productive each day!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ellenfinkelstein.com/acadblog/productivity-boost-ideas/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>How do I get all my AutoLISP routines to load themselves?</title>
		<link>http://www.ellenfinkelstein.com/acadblog/how-do-i-get-all-my-autolisp-routines-to-load-themselves/</link>
		<comments>http://www.ellenfinkelstein.com/acadblog/how-do-i-get-all-my-autolisp-routines-to-load-themselves/#comments</comments>
		<pubDate>Sun, 17 Feb 2008 10:18:20 +0000</pubDate>
		<dc:creator>Ellen</dc:creator>
				<category><![CDATA[Customization]]></category>
		<category><![CDATA[AutoCAD]]></category>
		<category><![CDATA[AutoLISP]]></category>

		<guid isPermaLink="false">http://www.ellenfinkelstein.com/acadblog/?p=1327</guid>
		<description><![CDATA[
			
				
			
		
<p>Question: B.N. asks how he can get his AutoLISP routines from an earlier release into AutoCAD 2007 so that they&#8217;re always loaded and ready to go.</p>
<p>Answer: An easy way is to type the AutoLISP routines in a file and save it as anything.lsp. Then choose Tools&#62; AutoLISP&#62; Load Application. Browse to anything.lsp and drag it [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.ellenfinkelstein.com%2Facadblog%2Fhow-do-i-get-all-my-autolisp-routines-to-load-themselves%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.ellenfinkelstein.com%2Facadblog%2Fhow-do-i-get-all-my-autolisp-routines-to-load-themselves%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p><span>Question:</span> B.N. asks how he can get his AutoLISP routines from an earlier release into <span id="IL_AD7">AutoCAD 2007</span> so that they&#8217;re always loaded and ready to go.</p>
<p><span><span id="IL_AD9">Answer</span>:</span> An easy way is to type the AutoLISP routines in a file and save it as <em>anything.lsp</em>. Then choose Tools&gt; AutoLISP&gt; Load <span id="IL_AD10">Application</span>. Browse to <em>anything.lsp</em> and drag it to the Startup Suite, which has an icon of a suitcase. Then it will load whenever you start AutoCAD.</p>
<p align="center"><img src="../../../images/acadtips_preload_autolisp-1.png" alt="" width="390" height="375" /></p>
<div style="overflow: hidden; color: #000000; background-color: transparent; text-align: left; text-decoration: none; border: medium none;"><a style="color: #003399;" href="../../../autocadtips/AutoCAD_tips_preload_autolisp.html#ixzz1QTETNrCd"></a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.ellenfinkelstein.com/acadblog/how-do-i-get-all-my-autolisp-routines-to-load-themselves/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Another Break Objects Quickly AutoLISP routine</title>
		<link>http://www.ellenfinkelstein.com/acadblog/another-break-objects-quickly-autolisp-routine/</link>
		<comments>http://www.ellenfinkelstein.com/acadblog/another-break-objects-quickly-autolisp-routine/#comments</comments>
		<pubDate>Sat, 04 Aug 2007 13:46:14 +0000</pubDate>
		<dc:creator>Ellen</dc:creator>
				<category><![CDATA[Editing]]></category>
		<category><![CDATA[AutoLISP]]></category>

		<guid isPermaLink="false">http://www.ellenfinkelstein.com/acadblog/?p=1209</guid>
		<description><![CDATA[
			
				
			
		
<p>In my earlier &#8220;Break objects quickly&#8221; tip, I have 4 routines that help you break objects more quickly than the standard AutoCAD command.</p>
<p>Febien Mosen sent me another routine, SCISSORS, that has 3 features:</p>

You don&#8217;t need to preselect the object; you just click the point where you want to break
Only if there are more than 1 [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.ellenfinkelstein.com%2Facadblog%2Fanother-break-objects-quickly-autolisp-routine%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.ellenfinkelstein.com%2Facadblog%2Fanother-break-objects-quickly-autolisp-routine%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>In my earlier &#8220;<a href="../../../AutoCAD_tips_break_objects_quickly.html">Break objects quickly</a>&#8221; tip, I have 4 routines that help you break objects more quickly than the standard AutoCAD command.</p>
<p><span>Febien Mosen</span> sent me another routine, SCISSORS, that has 3 features:</p>
<ul>
<li>You don&#8217;t need to preselect the object; you just click the point where you want to break</li>
<li>Only if there are more than 1 object under the break point  (that is, if you click on the intersection of objects), does the command  as you to select which object you want to break</li>
</ul>
<p>I tested it, and it worked fine for me.</p>
<p>You can <a href="../../../autocadtips/images/scissors.zip">download the AutoLISP file here</a>.</p>
<p>Here&#8217;s the code:</p>
<p>(defun C:SCISSORS( / pt1 bpt1 bpt2 ss1 dist1 ent1 centrecercle)<br />
;;make it quiet<br />
(setvar &#8220;cmdecho&#8221; 0)</p>
<p>;;first, get the breaking point<br />
(setq pt1 (getpoint &#8220;Give me the break point&#8230; &#8220;)) ;;point where to break</p>
<p>;;now, check if there&#8217;s more than one object under that point<br />
(setq ss1 (selectfrompoint pt1))</p>
<p>;;if there&#8217;s more than 1 object under point, ask to select, else use existing point<br />
(if (&gt; (sslength ss1) 1)<br />
(progn ;;then<br />
(princ &#8220;DISAMBIGUATION : pick the object to break&#8230;&#8221;)<br />
(setq ent1 (entsel))<br />
(setq ent1n (car ent1)) ;; e-name of ent1<br />
(setq bpt1 (cadr ent1)) ;; point on ent to break<br />
)<br />
(progn ;;else<br />
(setq ent1n (ssname ss1 0));;store into an entity (can be useful further)<br />
(setq bpt1 pt1) ;; point on ent to break<br />
)<br />
)</p>
<p>;;but if it&#8217;s a circle (thus usually unbreakable)&#8230;<br />
(if<br />
(= (cdr (assoc 0 (entget ent1n))) &#8220;CIRCLE&#8221;)<br />
;;then replace the circle by 2 arcs joining at the break point<br />
(progn<br />
(princ &#8220;It&#8217;s a circle !&#8221;)<br />
(setq centrecercle (cdr (assoc 10 (entget ent1n))))<br />
(command &#8220;_arc&#8221; &#8220;_c&#8221; centrecercle pt1 &#8220;_a&#8221; &#8220;180&#8243;)<br />
(command &#8220;_arc&#8221; &#8220;_c&#8221; centrecercle pt1 &#8220;_a&#8221; &#8220;-180&#8243;)<br />
(entdel ent1n)<br />
)<br />
;;else perform a normal break<br />
(progn<br />
(command &#8220;_break&#8221; bpt1 &#8220;_f&#8221; pt1 pt1)<br />
)<br />
)</p>
<p>;;restore cmdecho<br />
(setvar &#8220;cmdecho&#8221; 1)<br />
;;end quietly<br />
(princ)<br />
)</p>
<p>;;&#8212; this function makes a selection set of entities beneath a point<br />
(defun selectfrompoint (bpt1 / dist1 ss1)<br />
(setq dist1 (/ (getvar &#8220;viewsize&#8221;) 200)) ;; set a distance equal to 1/200-th of view height<br />
(setq ss1 ;;select by fence around point<br />
(ssget &#8220;_F&#8221;<br />
(list<br />
(list (+ (car bpt1) dist1) (+ (cadr bpt1) dist1) 0)<br />
(list (- (car bpt1) dist1) (- (cadr bpt1) dist1) 0)<br />
)<br />
)<br />
);; setq ss1<br />
ss1<br />
)</p>
<div style="overflow: hidden; color: #000000; background-color: transparent; text-align: left; text-decoration: none; border: medium none;"><a style="color: #003399;" href="../../../autocadtips/AutoCAD_tips_more_on_breaking_objects_quickly.html#ixzz1Q6gUxH4H"></a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.ellenfinkelstein.com/acadblog/another-break-objects-quickly-autolisp-routine/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Getting back the R14 full-screen cursor</title>
		<link>http://www.ellenfinkelstein.com/acadblog/getting-back-the-r14-full-screen-cursor/</link>
		<comments>http://www.ellenfinkelstein.com/acadblog/getting-back-the-r14-full-screen-cursor/#comments</comments>
		<pubDate>Tue, 16 Jan 2007 13:27:32 +0000</pubDate>
		<dc:creator>Ellen</dc:creator>
				<category><![CDATA[Drawing]]></category>
		<category><![CDATA[AutoLISP]]></category>

		<guid isPermaLink="false">http://www.ellenfinkelstein.com/acadblog/?p=1125</guid>
		<description><![CDATA[
			
				
			
		
<p>AutoCAD 2000 sets the default for the cursor at 5% of the screen. Many people like the old full-screen cursor. Abdul Nazar emails from India that you can change the cursor using this prompt.</p>
<p>Command: cursorsize
Enter new value for CURSORSIZE &#60;5&#62;: 100</p>
<p>You can also choose Tools&#62;Options and click the Display tab. There you can type in [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.ellenfinkelstein.com%2Facadblog%2Fgetting-back-the-r14-full-screen-cursor%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.ellenfinkelstein.com%2Facadblog%2Fgetting-back-the-r14-full-screen-cursor%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>AutoCAD 2000 sets the default for the cursor at 5% of the screen. Many people like the old full-screen cursor. <strong>Abdul Nazar</strong> emails from India that you can change the cursor using this prompt.</p>
<p>Command: cursorsize<br />
Enter new value for CURSORSIZE &lt;5&gt;: 100</p>
<p>You can also choose Tools&gt;Options and click the Display tab. There you can type in a new cursor size or use the slider bar.</p>
<p><strong>Bob Abernethy</strong> contributed a short AutoLISP file that  toggles the cursor size from 5% to 100% and back again. He includes a  bitmap file that you can use for a toolbar button. <a href="../../../images/chs.zip">Download it.</a></p>
<div style="overflow: hidden; color: #000000; background-color: transparent; text-align: left; text-decoration: none; border: medium none;"><a style="color: #003399;" href="../../../AutoCAD_tips_getting_R14_cursor.html#ixzz1Q0mApiii"></a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.ellenfinkelstein.com/acadblog/getting-back-the-r14-full-screen-cursor/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

