Associate Scale Bar block with user-selected viewport "custom scale" property
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi All,
My objective is to make a scale bar block that updates automatically with the viewport scale.
I imagine this can be best accomplished with a lisp file that loads automatically on startup. Pseudocode below (I don't know any LISP, so sorry if it's rough):
When (INSERT->"BLOCKNAME" <--My block's name is "SCALEBAR" Prompt user to select viewport to associate with block Get Custom Scale from viewport and store it <-- for this example, store as "CS" Replace "BLOCKNAME" attribute 1 value with formula: 1/CS <-- My attribute 1 is named "VPSCALE" Replace "BLOCKNAME" attribute 2 value with formula: 2/CS <-- My attribute 2 is named "VPSCALEX2" )
Things I've tried so far (and their limitations):
1) The option which has given me the best results is to insert my scale bar block and then edit the attributes (VPSCALE and VPSCALEX2) with a field containing the formula: 1/"Object->Viewport->Custom Scale". If I then copy and paste the paired viewport and scale bar, I can create a new paired viewport and scale bar. The main limitation is that my coworkers are terrible with blocks, probably don't even know what fields are, and this option doesn't give them the flexibility to just insert the scale bar block and easily be able to associate it with a viewport.
2) I've tried using the SheetSetPlaceholder "ViewportScale" in various configurations without success. The main problems are twofold: 1) My office doesn't really use SSM and especially not named views, which is a requisite to get ViewportScale to work (must be inserted from SSM->Named View->Callout Block; and 2) that it seems ViewportScale can't be used in a formula (reverts to ####).
2a) I tried using it directly in a formula field for VPSCALE: 1/"SheetSetPlaceholder->ViewportScale" (failed, reverted to ####).
2b) I tried using ViewportScale in an attribute called GETVALUE, and then using that in a formula for VPSCALE: 1/"Object->Attribute (GETVALUE)->Value" (failed, reverted to ####).
2c) It also can't be in a nested block (it has to be on the top level). I tried making a block called TEST which only contained the attribute GETVALUE. Then, in my scale bar block, I inserted the block TEST and changed the formula for VPSCALE to 1/"Object->Block Reference->GETVALUE" (failed, when the scale bar block is inserted, TEST/GETVALUE displays VIEWPORTSCALE).
3) I edited the code from this link to work with my scale bar block. The main limitation with this option are twofold: 1) The scale bar is static: If I change the viewport scale, the scale bar does not automatically update. 2) Requires a different workflow to insert the scale bar than every other block. Instead of using "INSERT->BLOCKNAME", users must now know to use "APPLOAD->MYLISP.LSP;->MYLISP".