ACADE scratch database in lisp

ACADE scratch database in lisp

gcsjlewis
Collaborator Collaborator
889 Views
4 Replies
Message 1 of 5

ACADE scratch database in lisp

gcsjlewis
Collaborator
Collaborator

I am working on looking at my scratch database and then inserting blocks into my layout based on what it finds.  These are the steps that i have taken so far:

 

(setq fnam (c:wd_mdb_get_proj_scratch_dbnam nil))

(setq hdl (wd_mdb_GetHandle 1))

(wd_mdb_Open hdl fnam)

(setq lst (wd_mdb_GetRecs hdl "COMP" "TAGNAME,MFG,CAT,RATING1" "" "TAGNAME"))

 

At this point i get a list of lists of in this format:

(("TAGNAME" . "SU1005") ("MFG" . "PHOENIX CONTACT") ("CAT" . "2856812")  ("RATING1" . "")))

 

Knowing this information i can go to our access database to get the block information using this API command

 

(setq filename (c:ace_get_footprint_fnam (list "MFG" "CAT" "ASSYCODE" "FLAG")))

 

And then insert the part using this API command

 

(c:wd_insymp filename (list 0.0 0.0) 0.0 1.0 nil)

 

Everything works. . . sort of.  The part is inserted, it has the proper information attached to it.  But when i run a bom report, it won't link to the right description found in our parts database. So it's not linking right.  I see in the access database it carries a RECNUM for every part.  Is there a way to attach that number so it carries through?

 

Thanks,

 

0 Likes
Accepted solutions (1)
890 Views
4 Replies
Replies (4)
Message 2 of 5

gcsjlewis
Collaborator
Collaborator
Accepted solution

I figured it out by adding xdata to the blocks dxf codes.  I still have to tweek it a little based on what type of block, but if anybody wants to see what i did let me know.

0 Likes
Message 3 of 5

yan_ken
Advocate
Advocate

Hi Jason, I was hoping if you could share this LISP file of yours. I am trying to insert blocks based on a exported BOM in xls with CATALOG and MFG columns, then automatically insert the blocks through the footprint database and simply skip the ones without it.

I had a post here but then I found your thread here that might able to help me.
https://forums.autodesk.com/t5/autocad-electrical-forum/a-way-to-skip-panel-component-dialog-box-whe...

 

Thanks very much!

0 Likes
Message 4 of 5

Sea-Haven
Mentor
Mentor

"I am trying to insert blocks based on a exported BOM in xls" You can read a Excel from CAD directly, so if you could provide more information a dwg and a sample Excel may be able to do something. 

0 Likes
Message 5 of 5

gcsjlewis
Collaborator
Collaborator

yan_ken,

 

I cannot post the lisp, but I can help walk you through it.  I just need to know a few things:

 

1.  Can you communicate with Excel currently to pull-in information.

 

2.  If I list the visual lisp & API commands I use, can you adjust them to work with your BOM.

 

Basically how much help do you need.  As I stated, I can walk you through it, but you would have to do the "leg work" to pull it all together.

0 Likes