<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Lisp for edit attribute in a nested block in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-for-edit-attribute-in-a-nested-block/m-p/7007746#M121437</link>
    <description>&lt;P&gt;There are a number of ways to generate a script file. First steps first though. Figure out the steps.&lt;/P&gt;
&lt;P&gt;First Step Back up all your blocks as they are now. Nothing worse than automatically screwing all your blocks up and then not being able to get back to what you had.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Next step redefine the Nested block. Open it delete the Attribute definition from the block. Keep in mind what that definition is. You might even consider wblocking the definition out to a temp block to be used in the script file in moment. Make sure to pick an insertion point that makes sense.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Close and save the nested block.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since we have our attdefinition in block now we can simply insert that exploded into each of our other blocks at the correct insertion point. Hopefully they are all the same location 0,0,0.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Work out the command sequence to insert the block exploded.&lt;/P&gt;
&lt;P&gt;INSERT MYBLOCK 0,0,0 ;;&lt;/P&gt;
&lt;P&gt;That should be all you need for the base of the script file.&lt;/P&gt;
&lt;P&gt;save that to a file with the .scr extension where you can find it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;open one of the blocks you wish to redefine&lt;/P&gt;
&lt;P&gt;use the scrip[t command to run it. Did it work? If so then we can move on. If not rework the Line above until it works as expected.&lt;/P&gt;
&lt;P&gt;Remeber it is only bringing in the ATTDEF nothing else.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You will aslo want to add the CIRCLE Block Redfine in as well.&lt;/P&gt;
&lt;P&gt;INSERT CIRCLE= 0,0,0 ;;;&lt;/P&gt;
&lt;P&gt;The Circle Block mus be on the path for this to work or you will have to provide the full path to the block and name after the =&amp;nbsp;&lt;/P&gt;
&lt;P&gt;close the drawing and don't save, we are testing.&lt;/P&gt;
&lt;P&gt;open it again and run the new script with both pieces. Did it work? keep both commands on one line, It will make the script file easier to build.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Open a DOS Window Windows Key + R -&amp;gt; CMD[Enter]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Change Directory to the folder where your 1000+ drawings are.&lt;/P&gt;
&lt;P&gt;run the following DOS Command&lt;/P&gt;
&lt;P&gt;DIR *.DWG /s /b &amp;gt;Myscript.scr&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This will generate a script file base to start that contains all of your dwg files with their path.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now Hopefully you have a good Text editor that allows for column editing. I use Jedit, Atom or even Visual Studio. JEDIT is pretty easy to use.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Open the myscript.scr file in your editor then append in front of every line. (you can also cheat and use replace text (Ctl+H) if you want.&lt;/P&gt;
&lt;P&gt;Your lines should all have "OPEN " in front of them.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now at the end we want to paste the script segment that we used to insert the attdef and redfine the block at the end. Make sure their is a space to separate the file name and the commands. Then at the end of it all we need to do is qsave and close the drawing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You then just run the script file and AutoCAD will run through all your drawings and make the changes. I recommend testing on a small batch first. Remember you made a copy for back up. Alwasy copy those when you need to tray again. Don't make the mistake of moving your backup.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hopefully you are familiar with this somewhat. Give it a go and let me know if you need some more help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are script generators out there, but I just use this method as it only take a few quick steps, once you know how to do it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck,&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>Mon, 10 Apr 2017 20:52:01 GMT</pubDate>
    <dc:creator>SeeMSixty7</dc:creator>
    <dc:date>2017-04-10T20:52:01Z</dc:date>
    <item>
      <title>Lisp for edit attribute in a nested block</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-for-edit-attribute-in-a-nested-block/m-p/7007525#M121429</link>
      <description>&lt;P&gt;Hi, I need to solve a problem to speed up my work.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN&gt;I have many drawing with one nested block attribute. I need to be able to edit the attribute of the nested block. There's any lisp that does&amp;nbsp;that?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Attached is the AutoCad. The block named "Circle" has an attribute of "diameter" and I need to edit&amp;nbsp;the value everytime I insert the block "Square"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope you can help me.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Apr 2017 19:04:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-for-edit-attribute-in-a-nested-block/m-p/7007525#M121429</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-04-10T19:04:19Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp for edit attribute in a nested block</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-for-edit-attribute-in-a-nested-block/m-p/7007543#M121430</link>
      <description>&lt;P&gt;There is a fundamental problem with the logic of your block structure. The block references a single insertion of the nested block in the block definition. So if you update the nested block with a value, it will update all of them, because all of your blocks reference just one occurrence of the nested circle block.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your attribute needs to be moved up to the parent block if you wish to have unique values for each block insertion.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want them all to have the same value, then simply open the parent block in BEDIT, double click the Circle Block, update the value and BCLOSE and Save. Done!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope that helps.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Apr 2017 19:14:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-for-edit-attribute-in-a-nested-block/m-p/7007543#M121430</guid>
      <dc:creator>SeeMSixty7</dc:creator>
      <dc:date>2017-04-10T19:14:33Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp for edit attribute in a nested block</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-for-edit-attribute-in-a-nested-block/m-p/7007544#M121431</link>
      <description>&lt;P&gt;Wouldn't it be better to un-nest those blocks? &amp;nbsp;Using a dynamic block would seem to make more sense. &amp;nbsp;Changing the diameter attribute wouldn't change the circle size, whereas adding parameters to the parent block would drive the circle.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What is the advantage of the nested block?&lt;/P&gt;</description>
      <pubDate>Mon, 10 Apr 2017 19:15:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-for-edit-attribute-in-a-nested-block/m-p/7007544#M121431</guid>
      <dc:creator>dbroad</dc:creator>
      <dc:date>2017-04-10T19:15:34Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp for edit attribute in a nested block</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-for-edit-attribute-in-a-nested-block/m-p/7007639#M121432</link>
      <description>&lt;P&gt;Hi SeeMSixty7,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need that each block that I insert has to have a different value for the "diameter" attribute.&lt;/P&gt;&lt;P&gt;Do you have a lisp to moved that attribute to the parent block? Or how can I do that for a lots of those blocks?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If I do it as the option you gave me, I would never end. I have like 1000 blocks.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Apr 2017 19:50:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-for-edit-attribute-in-a-nested-block/m-p/7007639#M121432</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-04-10T19:50:55Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp for edit attribute in a nested block</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-for-edit-attribute-in-a-nested-block/m-p/7007652#M121433</link>
      <description>&lt;P&gt;Hi dbroad,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for you answer.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The autocad that I attached is an example for what I need. I can't post the real block cause is a privacy policy of my work, but the essence is there.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you have a response for my reply of SeeMSixty7 it would be great.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Apr 2017 19:56:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-for-edit-attribute-in-a-nested-block/m-p/7007652#M121433</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-04-10T19:56:38Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp for edit attribute in a nested block</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-for-edit-attribute-in-a-nested-block/m-p/7007665#M121434</link>
      <description>&lt;P&gt;If you have 1000+ instances of the same block in one dwg file, then all you do is update the one block, and then run Battman to update the instances of that block.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have 1000+ block definitions using the nested block, then you will want to automate that process via lisp or a script file. Scriptfile is easy enough.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Which situation do you have?&lt;/P&gt;</description>
      <pubDate>Mon, 10 Apr 2017 20:05:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-for-edit-attribute-in-a-nested-block/m-p/7007665#M121434</guid>
      <dc:creator>SeeMSixty7</dc:creator>
      <dc:date>2017-04-10T20:05:32Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp for edit attribute in a nested block</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-for-edit-attribute-in-a-nested-block/m-p/7007694#M121435</link>
      <description>&lt;P&gt;I have the second situation you described.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"&lt;SPAN&gt;If you have 1000+ block definitions using the nested block, then you will want to automate that process via lisp or a script file. Scriptfile is easy enough"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Apr 2017 20:23:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-for-edit-attribute-in-a-nested-block/m-p/7007694#M121435</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-04-10T20:23:23Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp for edit attribute in a nested block</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-for-edit-attribute-in-a-nested-block/m-p/7007727#M121436</link>
      <description>&lt;P&gt;Seems to me you ought to delete the "circle" block with the attribute from its parent block and insert it in Modelspace, or maybe better yet trade it in for a piece of plain text that you can get at easily. &amp;nbsp;Is there other value to the "circle" block, and does it have to have an attribute?&lt;/P&gt;</description>
      <pubDate>Mon, 10 Apr 2017 20:43:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-for-edit-attribute-in-a-nested-block/m-p/7007727#M121436</guid>
      <dc:creator>john.uhden</dc:creator>
      <dc:date>2017-04-10T20:43:22Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp for edit attribute in a nested block</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-for-edit-attribute-in-a-nested-block/m-p/7007746#M121437</link>
      <description>&lt;P&gt;There are a number of ways to generate a script file. First steps first though. Figure out the steps.&lt;/P&gt;
&lt;P&gt;First Step Back up all your blocks as they are now. Nothing worse than automatically screwing all your blocks up and then not being able to get back to what you had.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Next step redefine the Nested block. Open it delete the Attribute definition from the block. Keep in mind what that definition is. You might even consider wblocking the definition out to a temp block to be used in the script file in moment. Make sure to pick an insertion point that makes sense.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Close and save the nested block.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since we have our attdefinition in block now we can simply insert that exploded into each of our other blocks at the correct insertion point. Hopefully they are all the same location 0,0,0.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Work out the command sequence to insert the block exploded.&lt;/P&gt;
&lt;P&gt;INSERT MYBLOCK 0,0,0 ;;&lt;/P&gt;
&lt;P&gt;That should be all you need for the base of the script file.&lt;/P&gt;
&lt;P&gt;save that to a file with the .scr extension where you can find it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;open one of the blocks you wish to redefine&lt;/P&gt;
&lt;P&gt;use the scrip[t command to run it. Did it work? If so then we can move on. If not rework the Line above until it works as expected.&lt;/P&gt;
&lt;P&gt;Remeber it is only bringing in the ATTDEF nothing else.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You will aslo want to add the CIRCLE Block Redfine in as well.&lt;/P&gt;
&lt;P&gt;INSERT CIRCLE= 0,0,0 ;;;&lt;/P&gt;
&lt;P&gt;The Circle Block mus be on the path for this to work or you will have to provide the full path to the block and name after the =&amp;nbsp;&lt;/P&gt;
&lt;P&gt;close the drawing and don't save, we are testing.&lt;/P&gt;
&lt;P&gt;open it again and run the new script with both pieces. Did it work? keep both commands on one line, It will make the script file easier to build.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Open a DOS Window Windows Key + R -&amp;gt; CMD[Enter]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Change Directory to the folder where your 1000+ drawings are.&lt;/P&gt;
&lt;P&gt;run the following DOS Command&lt;/P&gt;
&lt;P&gt;DIR *.DWG /s /b &amp;gt;Myscript.scr&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This will generate a script file base to start that contains all of your dwg files with their path.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now Hopefully you have a good Text editor that allows for column editing. I use Jedit, Atom or even Visual Studio. JEDIT is pretty easy to use.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Open the myscript.scr file in your editor then append in front of every line. (you can also cheat and use replace text (Ctl+H) if you want.&lt;/P&gt;
&lt;P&gt;Your lines should all have "OPEN " in front of them.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now at the end we want to paste the script segment that we used to insert the attdef and redfine the block at the end. Make sure their is a space to separate the file name and the commands. Then at the end of it all we need to do is qsave and close the drawing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You then just run the script file and AutoCAD will run through all your drawings and make the changes. I recommend testing on a small batch first. Remember you made a copy for back up. Alwasy copy those when you need to tray again. Don't make the mistake of moving your backup.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hopefully you are familiar with this somewhat. Give it a go and let me know if you need some more help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are script generators out there, but I just use this method as it only take a few quick steps, once you know how to do it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck,&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>Mon, 10 Apr 2017 20:52:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-for-edit-attribute-in-a-nested-block/m-p/7007746#M121437</guid>
      <dc:creator>SeeMSixty7</dc:creator>
      <dc:date>2017-04-10T20:52:01Z</dc:date>
    </item>
  </channel>
</rss>

