Jump to content

Recommended Posts

Posted

I've been "fixing" ADesk's stuff-up ... or trying to for a while now. But I'm hitting my head against one feature: Adding a Scale to an Object without using the -ObjectScale command. The reason I want to not use the command is that I want it to work inside of blocks as well.

 

Now it seems reasonably easy when it comes to blocks/text/mtext. Where it gets difficult is with dimensions, hatching & mleaders.

 

Attached is what I have so far. You may need some code in the Caddons Suite to run this as it uses some libraries from there. Most of it works reasonably, the function I've got problems with is Scales:Atatch on line 307. It's not complete, so I'd advise to not use it yet on any production drawings. And ity sertainly isn't optimized, I first wanted to get it to work ... so I'm calling functions numerous times where it could conceivably have been done much more efficiently. Functions might still also be renamed to be more consistent.

 

Basically my idea was to extract the currently displayed scale (Object Context Data Dictionary item). This works fine with the Scales:GetDisplayed function, which checks if the CAnnoScale equals one of the attached scales (which is gotten from the Scales:Entity:ListAttachedData function), if not then get the 1st attached scale. Then use that to generate a new DXF list - removing the -1,5,102 & 330 items, then modifying the items which vary due to the scale by a factor calculated from the newscale/displayedscale.

 

With dims, you get a reference to the unnamed block which forms the dim. Each context data seems to have its own unnamed block. So how should one generate such? Should I make a temporary dim to match, delete it then use it's non-purged unnamed block?

 

Then also hatches seem to have 2 separate dictionaries which contain separate contextdata items: an ACDB_ANNOTATIONSCALE_VIEW_COLLECTION (containing ACDB_HATCHVIEWCONTEXTDATA_CLASS items) and the "normal" ACDB_ANNOTATIONSCALES (containing ACDB_HATCHSCALECONTEXTDATA_CLASS items). Both of these items seem to have the exact same data for each scale attached ... up to a point (290 code). Then the HATCHVIEWCONTEXTDATA item has additional values 100, 330, 10, 51 & 290. Anyone have an idea what these entail?

 

I'm about 2 micro meters away from giving it all up for a bad try, and restarting it in C++/C#. Would be a shame really because it was getting real close! I've been trying to understand the ObjectARX help on this as well, though the closest thing I can see is the AcDbAnnotationScale::copyFrom method ... it doesn't say much about what it does. More about what error codes it returns.

Scales.LSP

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...