chiimayred Posted April 1, 2015 Posted April 1, 2015 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! Quote
Lee Mac Posted April 1, 2015 Posted April 1, 2015 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. Quote
chiimayred Posted April 1, 2015 Author Posted April 1, 2015 That worked perfectly! Thanks again Lee Mac. Quote
Recommended Posts
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.