Jump to content

VLOOKUP betwen AutoCAD and Excel?


Recommended Posts

Does anyone know how to achieve this?

 

I have a series of blocks with attributes in Autocad. Attribute is a number (from 1 to 500). Each of the blocks represents a single machine with serial number 1-500 on it.

 

When I place a new block of machine (I do it by copy/paste from the nearby block) I just change the attribute value manually.

 

Now, as a separate file I have excel sheet with two columns:

COLUMN A -> serial number of machines (1-500)

COLUMN B -> type of machine (e.g. TYPE-1, TYPE-2, TYPE-3...), around 8 types in total

 

Is it possible to make a block with two values in it (attributes) and when a value of machine serial number in position 1 is changed it will look the excel file and return the machine type in position 2. Something like VLOOKUP excel formula, but in AUTOCAD.

 

For example if EXCEL is:

 

COLUMN A / COLUMN B

250 / TYPE-3

251 / TYPE-5

 

Than the change in AutoCAD attributes in position 1 and 2 is like this:

ATT-1: 250 ATT-2: TYPE-3

if I manually change ATT-1 to value 251, then:

ATT-1: 251 ATT-2: TYPE-3

Link to comment
Share on other sites

I would look at some of the incrementing lisps so when add block it adds next number automatically. They work by looking up your block and retrieving the highest value. have a Look at www.Lee-mac.com auto numbering suite.

Here is an example of finding last number.

(setq ss1 (ssget "x" '((2 . "setout_point"))))
  (setq pno 0)
  (setq n (sslength ss1))   
  (setq index 0)
  (repeat n
     (setq en (ssname ss1 index))
     (setq index (+ index 1))
     (setq en1 (entnext en))
     (setq el1 (entget en1))
     (setq att (atoi (cdr (assoc 1 el1))))
     (if (> att pno) (setq pno att))
  );repeat
  (setq pno (+ pno 1))

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...