Jump to content
chiimayred

Custom Properties Error Help

Recommended Posts

chiimayred

Hey guys,

 

I'm working on a piece of code where I need the lisp to look up a custom property that's set and extract it.

 

The problem I am having is that we updated our templates within the last two years so this piece of code doesn't work properly with some of the older drawings we have.

 

I want it to assign the variable a value if it can't find it, but I don't know how to get around the automation error.

 

Here's my attempt but I am at a loss as to what to do.

 

(defun c:test (/ acadobject acaddocument dprops pp pp#)
(setq acadObject (vlax-get-Acad-Object))
 (setq acadDocument (vla-get-Activedocument acadObject))
 (setq dProps (vlax-get-property acadDocument 'Summaryinfo))
 (vla-getcustombyindex dprops 72 'PP 'PP#)
   (if (= PP# nil)
   (setq PP# "PLXX-X-XX-")
   );;end if
);;end defun

 

Here's the error I get.

 

Error: Automation Error. Out of range

 

FYI: The name of the custom property is Plot Plan

 

Thanks in advance!

Share this post


Link to post
Share on other sites
Lee Mac

The error message you are receiving would seem to indicate that the index argument that you have supplied to the method is too high for the number of custom properties defined in your drawing; however, since you already know the property name, you could use the ActiveX getcustombykey method instead.

Share this post


Link to post
Share on other sites
chiimayred

That worked perfectly!

 

Thanks again Lee Mac.

Share this post


Link to post
Share on other sites
Lee Mac

You're most welcome!

Share this post


Link to post
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
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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...