Bill Tillman Posted August 27, 2012 Posted August 27, 2012 As most of you know I work with automation processes which create drawings on the fly. The trick I'm trying to perform now is how to get at least three different annotative scales applied to text and dimension objects as they are created. I've experimented around with this a bit but getting a method which would add not just the current CANNOSCALE to the object but two additional ones, is not something I seem to find a way of doing. Quote
Lee Mac Posted August 27, 2012 Posted August 27, 2012 As far as I know, the individual Annotative AcDbScale entities for each Annotative Scale associated with an object can each be accessed from an accompanying AcDbAnnotScaleObjectContextData entity, which are all stored (one for every scale) in a Dictionary which itself is stored in the ACDB_ANNOTATIONSCALES Dictionary, which is stored in the AcDbContextDataManager Dictionary, which can be accessed from the Extension Dictionary of the Annotative object. To further elucidate the structure, the following function will return a list of all Annotative Scales associated with an object: [color=GREEN];; Get Annotative Scales - Lee Mac[/color] [color=GREEN];; Returns a list of Annotative Scales associated with an object[/color] ([color=BLUE]defun[/color] LM:GetAnnotativeScales ( ent [color=BLUE]/[/color] enx itm lst ) ([color=BLUE]if[/color] ([color=BLUE]and[/color] ([color=BLUE]setq[/color] ent ([color=BLUE]entget[/color] ent '([color=MAROON]"AcadAnnotative"[/color]))) ([color=BLUE]setq[/color] enx ([color=BLUE]cadr[/color] ([color=BLUE]assoc[/color] -3 ent))) ([color=BLUE]=[/color] 1 ([color=BLUE]cdr[/color] ([color=BLUE]assoc[/color] 1070 ([color=BLUE]reverse[/color] enx)))) ([color=BLUE]setq[/color] ent ([color=BLUE]cdr[/color] ([color=BLUE]assoc[/color] 360 ([color=BLUE]member[/color] '(102 . [color=MAROON]"{ACAD_XDICTIONARY"[/color]) ent)))) ([color=BLUE]setq[/color] ent ([color=BLUE]cdr[/color] ([color=BLUE]assoc[/color] -01 ([color=BLUE]dictsearch[/color] ent [color=MAROON]"AcDbContextDataManager"[/color])))) ([color=BLUE]setq[/color] ent ([color=BLUE]cdr[/color] ([color=BLUE]assoc[/color] -01 ([color=BLUE]dictsearch[/color] ent [color=MAROON]"ACDB_ANNOTATIONSCALES"[/color])))) ) ([color=BLUE]while[/color] ([color=BLUE]setq[/color] itm ([color=BLUE]dictnext[/color] ent ([color=BLUE]null[/color] itm))) ([color=BLUE]setq[/color] lst ([color=BLUE]cons[/color] ([color=BLUE]cdr[/color] ([color=BLUE]assoc[/color] 300 ([color=BLUE]entget[/color] ([color=BLUE]cdr[/color] ([color=BLUE]assoc[/color] 340 itm))))) lst)) ) ) ([color=BLUE]reverse[/color] lst) ) To test, supply the above function with the entity name of an Annotative object, e.g.: ([color=blue]defun[/color] c:test ( [color=blue]/[/color] en ) ([color=blue]if[/color] ([color=blue]setq[/color] en ([color=blue]car[/color] ([color=blue]entsel[/color]))) ([color=blue]print[/color] (LM:GetAnnotativeScales en)) ) ([color=blue]princ[/color]) ) The above may print a list such as: TEST Select object: ([color=darkred]"1:1" "1:2" "1:4"[/color]) Or nil if the selected object is not Annotative. I hope this helps! Quote
Bill Tillman Posted August 28, 2012 Author Posted August 28, 2012 I read this in an article last night about the annotative scales being stored separately in a Dictionary. Still studying up on that. I also saw that the OBJECTSCALE command may be a down and dirty way to add the additional scales to the objects. I tried it only long enough to see that it might work but then was distracted by other tasks. I'm hoping to draft a method this week to take care of this. 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.