Author Topic: dynamic blocks  (Read 8834 times)

0 Members and 1 Guest are viewing this topic.

Thomas 3D

  • Guest
dynamic blocks
« on: December 27, 2010, 03:06:15 AM »
Hello Forum,

I have the problem, that I can't distinguish the dynamic blocks in my drawing, because all blocks have the same blockname.

I have create a dyn. block with a length1. This block I have copied several times in one drawing. I have stretched or trimed the blocks. That means I have different blocks with different lengths.

I look for a tool, which create a automatically ID number as a attribut in the dyn. block. I don't know if that is possible, when I start the copy command, that each new dyn. block gets a new attribute (ID Number).
Because I want to read the blocks in a table.

I would like to know, if anybody ever written such a tool?

I would appreciate about short message.

Best regards
Thomas

pBe

  • Bull Frog
  • Posts: 402
Re: dynamic blocks
« Reply #1 on: December 27, 2010, 07:13:47 AM »
use this as reference:

Code: [Select]
(defun c:test (/ object)
   (vl-load-com)
(setq object (car (entsel "\nSelect Block:")))

(if (equal
   (vla-get-IsDynamicBlock (vlax-ename->vla-object object)) :vlax-true)
        (princ (strcat "\n<< Block " (vla-get-effectivename  (vlax-ename->vla-object object)) " is a Dynamic block >>"))
        (princ "\nNot a Dynamic block")  
          )(princ)
  )

what you can do is when you loop through the entries of the selection set (ssget ...) create a test to check for effective name/or not (that is if your block names are *U71*) and if its a dynamic
block. check for dynamic property (the length).....

hope this helps.
BTW, i cant open your file.. i'm using 2009  :-)

EDIT: I think i misunderstood the question... oh well  :-)  
« Last Edit: December 27, 2010, 07:31:21 AM by pBe »

kruuger

  • Swamp Rat
  • Posts: 635
Re: dynamic blocks
« Reply #2 on: December 27, 2010, 08:07:10 AM »
this is not reactor but... :-)
when you put all MULLION in dwg type ID (load lisp first).
you need to use my block (with new attribute ID)
kruuger

Thomas 3D

  • Guest
Re: dynamic blocks
« Reply #3 on: December 27, 2010, 02:40:25 PM »
Hi pBe,

thanks for your help. I'm not sure if you have understand me. I have saved the DWG-file for you in the AutoCad 2007 format.
Sorry, but I understand nothing about programming. I have copied your code in a txt-file and then I have rename the Suffix to lsp. I hope that was right.
I don't know what it is "ssget". Would it be possible for you to give me a more detailed description?
Thanks!!!


Thomas

Thomas 3D

  • Guest
Re: dynamic blocks
« Reply #4 on: December 27, 2010, 03:05:18 PM »
Hi Kruuger,

this is not reactor but... :-)
when you put all MULLION in dwg type ID (load lisp first).
you need to use my block (with new attribute ID)
kruuger

I have tried to use your 2 files, but if I type "ID"  then Autocad start the AutoCad command ID-Point. Is that right? :|

Thomas

kruuger

  • Swamp Rat
  • Posts: 635
Re: dynamic blocks
« Reply #5 on: December 27, 2010, 03:34:51 PM »
Hi Kruuger,

this is not reactor but... :-)
when you put all MULLION in dwg type ID (load lisp first).
you need to use my block (with new attribute ID)
kruuger

I have tried to use your 2 files, but if I type "ID"  then Autocad start the AutoCad command ID-Point. Is that right? :|

Thomas

just drag my AutoID.lsp into dwg (you need to load program before use).
then type ID again.
if you find it usefull add it to suitcase:
http://lee-mac.com/autoloading.html

kruuger

Thomas 3D

  • Guest
Re: dynamic blocks
« Reply #6 on: December 28, 2010, 09:28:25 AM »
Hi Kruuger,

It does not work for me. I thing the problem is, that I work with a German AutoCad Version. The German version has a mix of German and English commands. If I type ID, then AutoCad starts the command ID-Point (x;y;z). Would it be possible for you to use another command name for your lisp command?

Thomas

kruuger

  • Swamp Rat
  • Posts: 635
Re: dynamic blocks
« Reply #7 on: December 28, 2010, 09:49:14 AM »
Hi Kruuger,

It does not work for me. I thing the problem is, that I work with a German AutoCad Version. The German version has a mix of German and English commands. If I type ID, then AutoCad starts the command ID-Point (x;y;z). Would it be possible for you to use another command name for your lisp command?

Thomas

Thomas
I change shortcut to AUTOID.
Please download lsp file again. When you drag file to autocad you should see this at command line: ** Loaded AUTOID.LSP. Type AUTOID to invoke. **
You need to load lisp EVERYTIME you start new dwg.
kruuger


Thomas 3D

  • Guest
Re: dynamic blocks
« Reply #8 on: December 28, 2010, 12:47:28 PM »
Hi Kruuger,

I have done everything like you said it. I get the following error message:

Befehl:
** Loaded AUTOID.LSP. Type AUTOID to invoke. **
Befehl:
Befehl: AUTOID
; Fehler: no function definition: JK:ACX_ACTDOC

I have no idea what Autocad wants from me. :|

Thomas

kruuger

  • Swamp Rat
  • Posts: 635
Re: dynamic blocks
« Reply #9 on: December 28, 2010, 01:48:22 PM »
Hi Kruuger,

I have done everything like you said it. I get the following error message:

Befehl:
** Loaded AUTOID.LSP. Type AUTOID to invoke. **
Befehl:
Befehl: AUTOID
; Fehler: no function definition: JK:ACX_ACTDOC

I have no idea what Autocad wants from me. :|

Thomas
aaa, now everything is clear. missing sub-function.
try this attachment. now should work for 100%
kruuger

Thomas 3D

  • Guest
Re: dynamic blocks
« Reply #10 on: December 28, 2010, 03:06:48 PM »
Sorry,

but now I get the following message


Befehl:
Befehl: (LOAD "E:/Neuer Ordner/AutoID.lsp")
** Loaded AUTOID.LSP. Type AUTOID to invoke. **

Befehl: AUTOID
; Fehler: no function definition: VLAX-GET-ACAD-OBJECT   :?


kruuger

  • Swamp Rat
  • Posts: 635
Re: dynamic blocks
« Reply #11 on: December 28, 2010, 03:38:21 PM »
Sorry,

but now I get the following message


Befehl:
Befehl: (LOAD "E:/Neuer Ordner/AutoID.lsp")
** Loaded AUTOID.LSP. Type AUTOID to invoke. **

Befehl: AUTOID
; Fehler: no function definition: VLAX-GET-ACAD-OBJECT   :?


add this (vl-load-com) at the top of AutoID.lsp
Code: [Select]
(vl-load-com)
(defun C:AUTOID (/ LS SS SS_MUL ID)
  (setq LS
....
kruuger

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: dynamic blocks
« Reply #12 on: December 28, 2010, 03:38:55 PM »
Enter this at the command line:

(vl-load-com)

Then try your proggy again.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Thomas 3D

  • Guest
Re: dynamic blocks
« Reply #13 on: December 28, 2010, 04:34:59 PM »
 :-)
It works. THANKS!!!!

What do you think? When I should start the routine? When I have finished the drawing?
When I use the routine in between,then the ID numbers have been assigned twice. Is it possible to change the routine so that the repeated use of the routine, the ID numbers will be deleted and re-assigned?

kruuger

  • Swamp Rat
  • Posts: 635
Re: dynamic blocks
« Reply #14 on: December 28, 2010, 05:10:38 PM »
:-)
It works. THANKS!!!!
uff  :wink:

When I use the routine in between,then the ID numbers have been assigned twice. Is it possible to change the routine so that the repeated use of the routine, the ID numbers will be deleted and re-assigned?
i'm not sure i understood you but try this one.
first block should be 1. when you add more they should be 2, 3, 4...but i'm not sure if ssget always return list object from last to first in drawing base. can someone confirm that?

thanks
kruuger

« Last Edit: December 29, 2010, 10:33:23 AM by kruuger »