Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
New Member
gus.oleary
Posts: 1
Registered: ‎04-25-2012
Message 1 of 4 (512 Views)

Custom Fields, VLisp, and the Scales

512 Views, 3 Replies
04-25-2012 05:25 AM

I'm a long time reader, but a first time poster, so here goes:



I've successfully written a lisp routine to insert a scale bar dynamic block with attributes, gather the object id of a user selected viewport, and write fields to attributes (thank you Lee Mac!) for each of the numbers across the top of the typical scale bar as well as the scale name, for both architectural and civil units. I'm trying to come up with a similar dynamic block\lisp routine combination to do the same with view titles, and the associated scale callout. The catch in this case is that I'd like to display the scale as "NTS" if it isn't a proper scale. The "standardscale" object property option in the field dialog box gives me almost exactly what I want, except that non-standard scales are displayed as "CUSTOM" as opposed to "NTS". Moreover, I’d like this to update on the fly, if the viewport scale changes, the scale callout needs to change also, back and forth from “NTS” to a standard scale if need be.



So the first question is: is there a way to change that (CUSTOM \ NTS)? My research online seems to indicate that the nuts and bolts of fields are deeply rooted in ObjectARX, which is something I know very little about, does anyone have a pointer in that regard?



The natural followup to that question is, if I can't change "CUSTOM" to read "NTS", is there a way to wrangle this whole thing with reactors? I'm envisioning object reactors, created as a part of the insertion routine, for each individual instance of the block (there could very well be several in a layout, and multiple layouts in detail drawings), that would call another routine to evaluate the viewport scale, and if it didn’t match a list of standard scales, write NTS to the attribute. My issue is that reactors seem to only associate with one object, in this case that’d be the viewport, the reaction would cause the reactor to call the routine, but how does the routine know which block to update? Is there something from the viewport properties that I can add to the block name (or some other property) which will allow the routine to figure out which block to edit? Nothing comes to mind… so again, I’d appreciate any help I can get.



I’ve attached my scale bar code, and block, as reference \ context for how I plan to set the view title up. If there is another angle of attack on this besides what I’ve described, let me know! Suggestions\comments\advice is most welcome!

*Expert Elite*
dbroad
Posts: 1,563
Registered: ‎08-16-2007
Message 2 of 4 (486 Views)

Re: Custom Fields, VLisp, and the Scales

04-26-2012 05:51 PM in reply to: gus.oleary

AFAIK, field expressions are relatively limited in that they do not support formulas with conditions and do not support lisp expressions other than accessing variables.  If they supported vbscript, then you could easily do what you want.  If you really need this feature, go to objectdbx or hack it with reactors.  I do not recommend reactors but in a pinch, if drawings are only for in-house use, then they might be acceptable.  An object reactor owned by the viewport could possibly set the text value or tagstring of another entity, acting like a field.

*Expert Elite*
M_Hensley
Posts: 1,712
Registered: ‎12-11-2003
Message 3 of 4 (474 Views)

Re: Custom Fields, VLisp, and the Scales

04-27-2012 03:42 AM in reply to: gus.oleary

I'm no diesel expert, but I have seen some fields that use diesel expressions to do some computations similar to lisp. You may be able to do some of what you need with diesel in a field.

*Expert Elite*
dbroad
Posts: 1,563
Registered: ‎08-16-2007
Message 4 of 4 (467 Views)

Re: Custom Fields, VLisp, and the Scales

04-27-2012 10:01 AM in reply to: gus.oleary

diesel doesn't support nested fields

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.