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!
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.
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.
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register
Start with some of our most frequented solutions to get help installing your software.