TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Zykl0 on May 21, 2009, 09:24:15 AM

Title: Need something else than attributes extraction.
Post by: Zykl0 on May 21, 2009, 09:24:15 AM
Hello all,

I am currently working on something for my boss.
Basically this is a excel file where we going to merge a lot of document together and information about each project.
I discovered a lisp file able to read specific cell in excel (READCELL) and another one able to write a specific cell in a specific worksheet (PUTCELL).

What i need:
 -I would like to be able to extract each block quantity into specific cell in excell using the command PUTCELL i have.
   ;   Syntax:  (PutCell StartCell$ Data$) or (PutCell StartCell$ DataList@)
   ;   Example: (PutCell "A1" (list "GP093" 58.5 17 "Base" "3'-6 1/4\""))

Condition:
-Many of our block are dynamic with different name *Ublahblah , impossible to count, But i'm going to add invisible attribute with the name of the item in each block, for better calculation later.

-The zone of the block selection should be generated  automatically, to prevent clone of the same block (counted twice) like the same detail with 2-3 different view. i'm going to design each floor above X + Z axis (meaning top right of the X-Y icon in model space), and every detail under X axis (X-1 to 500 etc.) this way the block attribute extraction selection does not count extra block.


Begging:
Can someone explain me how to do this with example please? my Lisp scripting is limited to adjusting other people script to fit my needs, but i cannot find something similar actually :)

thank you very very much for your help!
Title: Re: Need something else than attributes extraction.
Post by: T.Willey on May 21, 2009, 11:05:27 AM
When working with dy blocks, you can get the name of the original block by two ways.  The easier way is to use ActiveX.  With AX there is a property called ' EffectiveName ' which is the orig. name of the block.  If you want to do a list of blocks that are inserted, then you are going to have to just grab all blocks, and the step through them making a list of their quantities associated with the EffectiveName of each one.
Title: Re: Need something else than attributes extraction.
Post by: CAB on May 21, 2009, 11:21:22 AM
I think this will allow you to get all blocks that have a z-axis value of 0.0
Code: [Select]
(setq ss (ssget "X" '((0 . "INSERT")(-4 . "*,*,=")(10 0.0 0.0 0.0))))You may want to confine the blocks selected to current space by using this
Code: [Select]
(setq sset (ssget "X" (list (0 . "INSERT")(-4 . "*,*,=")(10 0.0 0.0 0.0)(cons 410 (getvar "ctab")))))
Title: Re: Need something else than attributes extraction.
Post by: ronjonp on May 21, 2009, 11:38:45 AM
This should help you with the counting: http://www.theswamp.org/index.php?topic=28660.msg342865#msg342865
Title: Re: Need something else than attributes extraction.
Post by: Zykl0 on May 22, 2009, 11:57:15 AM
This should help you with the counting: http://www.theswamp.org/index.php?topic=28660.msg342865#msg342865

This is interesting but on mostly every different project i have error,

; error: bad argument type: stringp nil

some block inside the drawing might be bugged.
Title: Re: Need something else than attributes extraction.
Post by: ronjonp on May 22, 2009, 12:35:56 PM
This should help you with the counting: http://www.theswamp.org/index.php?topic=28660.msg342865#msg342865

This is interesting but on mostly every different project i have error,

; error: bad argument type: stringp nil

some block inside the drawing might be bugged.

I updated the code...it had a bug  :lol:
Title: Re: Need something else than attributes extraction.
Post by: Zykl0 on May 22, 2009, 01:13:36 PM
Thank you Ron, this is a very useful tool you made,

I will try to adjust this to export this to my excel cell!