Author Topic: DimStyleTableRecords  (Read 9534 times)

0 Members and 1 Guest are viewing this topic.

Glenn R

  • Guest
DimStyleTableRecords
« on: November 09, 2007, 11:31:18 PM »
Has anyone down anything with these beasties? I'm cloning one from a source dbase to the current dbase when needed, however it sometimes will appear with "Style Overrides" showing in the dim style manager.

I suspect it's occuring when the dim vars in the editor differ in any way from the newly cloned entry...the editor's values get applied as overrides....I think......

I've cloned/copyobjects in VBA I think, but it was a while ago...or was it creating a dimstyle....I seem to remember setting all the dimvars that I wanted, create the dimstyle and then use copyobjects on the dimstyle to get all the settings from the editor.....but I can't remember...maybe this will jog somebody else's memory.

There seems to little in the way of discourse or examples in the ARX docs, but I'll keep looking.

Cheers,
Glenn.

Glenn R

  • Guest
Re: DimStyleTableRecords
« Reply #1 on: November 09, 2007, 11:34:59 PM »
For anybody who wants to play along, here is some test code:

LillyPondCode

Also attached is the "source" drawing. Build the dll and place the dwg in the same folder as the dll and then NETLOAD.

Cheers,
Glenn.
« Last Edit: November 11, 2007, 06:55:13 PM by Glenn R »

Glenn R

  • Guest
Re: DimStyleTableRecords
« Reply #2 on: November 09, 2007, 11:36:09 PM »
Forgot to mention that the code and the dwg are for 2008.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: DimStyleTableRecords
« Reply #3 on: November 10, 2007, 12:31:56 AM »
Maybe it is showing style overrides because you haven't set the new style current?  Other examples are just copying over the styles, but if the style you are coping is current, and there are dim style overrides set already then I would think that it would keep the style overrides until you set the newly copied one current.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Glenn R

  • Guest
Re: DimStyleTableRecords
« Reply #4 on: November 10, 2007, 12:45:25 AM »
The style overrides are on my copy - there are no overrides on any other dim styles in the destination drawing and there are no overrides on my source dim style either...

T.Willey

  • Needs a day job
  • Posts: 5251
Re: DimStyleTableRecords
« Reply #5 on: November 10, 2007, 06:09:02 PM »
I don't know what else it could be then.  If you set the new style current, are there still overrides?  I can test some stuff when I get to work on Monday, but you may solve the answer by then.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Glenn R

  • Guest
Re: DimStyleTableRecords
« Reply #6 on: November 10, 2007, 06:47:02 PM »
Thanks for looking Tim...I'll keep scratching away and see what I can come up with.

Quote from: AutoCAD ActiveX and VBA Reference
The active dimension style determines the appearance of new dimensions that are created in the drawing. To change the style of an existing dimension, use the StyleName property found on the dimension.

To control the settings of the current document overrides, use the dimensioning system variables. See "System Variables" in the AutoCAD Command Reference for a list of dimensioning system variables.

When you change a dimensioning system variable, you are actually setting a document override for the active dimension style; you are not changing the active dimension style itself. This means that all newly created dimensions will still be created with the active dimension style only and will not reflect the overrides from the system variables. The overrides from the system variables will not be recognized on new dimensions until the active dimension style is updated. To change the settings of any dimension style, use the CopyFrom method. This method copies a dimension style configuration, including overrides, from a document, dimension, or other dimension style.

Dimensions created via the AutoCAD user interface are created with the active dimension style plus all document overrides. Dimensions created via ActiveX are created with the active dimension style only. To have the dimensions created via ActiveX take on the document overrides, use the CopyFrom method to copy the dimension style from the document to the active dimension style. This process will copy all existing overrides into the active dimension style.

I just opened AutoCAD and in the default startup  drawing, I set the DIMSCALE = 10. I then looked at the Dimstyles in the Dim Style manager and sure enough, the current style had an override on it. I then set the DIMSCALE back to 1 and looked in the Dim Style Manager again and the override is gone.

Taking that behaviour with the quoted text above, I think I will have to check each dim style var against each document override and reset the document override to match the dim style var if they are different...I hope there is an easier way...

T.Willey

  • Needs a day job
  • Posts: 5251
Re: DimStyleTableRecords
« Reply #7 on: November 10, 2007, 06:50:49 PM »
Taking that behaviour with the quoted text above, I think I will have to check each dim style var against each document override and reset the document override to match the dim style var if they are different...I hope there is an easier way...
You should just be able to set the dim style current, as the overrides will go away once you make that style current.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Glenn R

  • Guest
Re: DimStyleTableRecords
« Reply #8 on: November 10, 2007, 06:54:52 PM »
Tim,

What I just found was the opposite. The code I posted was NOT setting the newly cloned DIMSTYLE current at the end and if you run it in AutoCAD with the current dimstyle having overrides, then the clone comes in fine with no overrides.

If, however, you do the same process, but add setting the new clone current at the end of the code, then it takes all the overrides from the current dimstyle...the plt thickens...

Cheers,
Glenn.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: DimStyleTableRecords
« Reply #9 on: November 10, 2007, 06:56:26 PM »
Glenn,
Can the dimstyle be saved after it is copied.

From Lisp I set variables then save the Dimstyle sucessfully ...not cloned though ..
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: DimStyleTableRecords
« Reply #10 on: November 10, 2007, 06:58:43 PM »
That sounds backwards.  I wonder if when you are setting it current if it is saving the overrides from some reason?  Sorry I can't test anything from home, as this has peaked my interests now.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Glenn R

  • Guest
Re: DimStyleTableRecords
« Reply #11 on: November 10, 2007, 07:00:06 PM »
Glenn,
Can the dimstyle be saved after it is copied.

From Lisp I set variables then save the Dimstyle sucessfully ...not cloned though ..

I'm not following you there Kerry, can you elaborate a bit please?
Do you mean you're setting all the document overrides, then using CopyFrom to copy those settings into your new style?

Glenn R

  • Guest
Re: DimStyleTableRecords
« Reply #12 on: November 10, 2007, 07:02:57 PM »
That sounds backwards.  I wonder if when you are setting it current if it is saving the overrides from some reason?  Sorry I can't test anything from home, as this has peaked my interests now.

I know and it could be troublesome. Unfortunately, I must set the cloned DIMSTYLE active as this is kicked off from a CommandWillStart event and if a dimensioning command, I need to set a particular style current.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: DimStyleTableRecords
« Reply #13 on: November 10, 2007, 07:07:05 PM »

Not doing a copy from ..

simply

Restore a style
Setvars for the changes I want to make ( which creates overrides)
Save the Style with the new name.

I'm wondering if saving the Style after CopyFrom is required.

Are the overrides different to the copied Style ?
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Glenn R

  • Guest
Re: DimStyleTableRecords
« Reply #14 on: November 10, 2007, 07:08:34 PM »
Quote from: AutoCAD ActiveX VBA Reference - ActiveDimStyle Property
This style will be applied to all newly created dimensions. To change the style on an existing dimension, use the StyleName property.

To control the settings of the current document overrides, use the dimensioning system variables. See "System Variables" in the AutoCAD Command Reference for a list of dimensioning system variables.

When you change a dimensioning system variable, you are actually setting a document override for the active dimension style. You are not changing the active dimension style itself. To change the settings of a given dimension style, use the CopyFrom method. This method copies a dimension style configuration, including overrides, from a document, dimension, or other dimension style.

Dimensions created via the AutoCAD user interface are created with the active dimension style plus all document overrides. Dimensions created via ActiveX are created with the active dimension style only. To have the dimensions created via ActiveX take on the document overrides, use the CopyFrom method to copy the dimension style from the document to the active dimension style. This process will copy all existing overrides into the active dimension style.

Hmmm...DimStyle object and ActiveDimStyle Property have 2 slighly different explanations...

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: DimStyleTableRecords
« Reply #15 on: November 10, 2007, 07:10:27 PM »
..................... Unfortunately, I must set the cloned DIMSTYLE active as this is kicked off from a CommandWillStart event and if a dimensioning command, I need to set a particular style current.

not really off topic.

Are the styles defined with Dimscale 1
then is the Active Dimscale ( say 10 )used as an override ?

kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Glenn R

  • Guest
Re: DimStyleTableRecords
« Reply #16 on: November 10, 2007, 07:11:08 PM »

Not doing a copy from ..

simply

Restore a style
Setvars for the changes I want to make ( which creates overrides)
Save the Style with the new name.

I'm wondering if saving the Style after CopyFrom is required.

Are the overrides different to the copied Style ?


What lisp functions are you using to restore and save Kerry?
Not sure what you mean by overrides different to the copied style...there are no overrides in my source dimstyle, only in the current dimstyle in the current drawing...those are being attached to the new cloned entry...

Glenn R

  • Guest
Re: DimStyleTableRecords
« Reply #17 on: November 10, 2007, 07:13:12 PM »
Are the styles defined with Dimscale 1
then is the Active Dimscale ( say 10 )used as an override ?

That's the intent when this is finished, spot on. The dimscale override will be used/kicked off from the user before this cloning takes process...at least that's what I'm thinking at this point.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: DimStyleTableRecords
« Reply #18 on: November 10, 2007, 07:28:42 PM »
Are the styles defined with Dimscale 1
then is the Active Dimscale ( say 10 )used as an override ?

That's the intent when this is finished, spot on. The dimscale override will be used/kicked off from the user before this cloning takes process...at least that's what I'm thinking at this point.

Thats sort of what we do.
Styles defined at configuration.

Then do this sort of thing ..

Code: [Select]
(DEFUN cta17:restoredimstyle (ds / tmp)
  (IF (VL-POSITION ds (ai_table "DIMSTYLE" 0))
(PROGN (SETQ tmp (GETVAR "dimscale"))
   (VL-CMDF "._DIM1" "RESTORE" ds)
   (SETVAR "dimscale" tmp)
   (PROMPT (STRCAT "\nDimstyle " ds " Restored"))
)
(PROMPT
  (STRCAT "\nUNABLE to Dimstyle Restored Dimstyle " ds)
)
  )
  (PRINC)
)

(DEFUN c:stda35 () (cta17:restoredimstyle "stda35") (PRINC))
(DEFUN c:std35 () (cta17:restoredimstyle "std35") (PRINC))
(DEFUN c:dimr30 () (cta17:restoredimstyle "STDRUNNER30") (PRINC))
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Glenn R

  • Guest
Re: DimStyleTableRecords
« Reply #19 on: November 10, 2007, 07:41:14 PM »
That's what I sort of thought you were doing Kerry...thanks for that. I'm still no closer to solving, however i'm starting to develop some thoughts on a couple of different attacks.

Cheers,
Glenn.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: DimStyleTableRecords
« Reply #20 on: November 10, 2007, 08:04:40 PM »

Glenn, I don't think it's an issue.
The Overrides showing are the differences between the current and the highlighted. ( I think)

As soon as the 1-1 style is made current the overrides show on the other styles ..
.. appears to not affect the style as drawn.


kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Glenn R

  • Guest
Re: DimStyleTableRecords
« Reply #21 on: November 10, 2007, 08:16:12 PM »
Kerry,

Here is some updated code to set the cloned dimstyle active.

Now, once you've built that dll and tossed the drawing I attached previously into the same folder as the dll, load AutoCAD and start a new drawing. Once in, goto the Dim Style manager and verify that the active Dim Style has no overrides on it. Now, at the command line, type in DIMSCALE and change it to something other than it's current value for the current style - this should now give you style overrides on the current style in Dim Style Manager.

Now, NETLOAD the dll and run the command 'Dolly'. If this completes successfully, you should now see in the dimension toolbar that the '1-1' style has been cloned in and is active. Now fire up the Dim Style Manager and you should see that the overrides that were on your previously current style are now on the new cloned entry...not desirable.

Can you verify please?

Cheers,
Glenn.
« Last Edit: November 11, 2007, 08:09:41 AM by Glenn R »

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: DimStyleTableRecords
« Reply #22 on: November 10, 2007, 08:40:13 PM »
ahhh, I see what you mean.
looks like the style is not being correctly set current
added: even though the style IS shown current in the ToolbarCombo and in the DimStyleManager.

after the netload, If you go into the DimStyleManager and manually set the style current it seems to work as expected

similarly ; dim1 restore 1-1 does the same thing correctly.

That seems like a wobbly .. like for me to report it ?
« Last Edit: November 10, 2007, 09:04:34 PM by Kerry Brown »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Glenn R

  • Guest
Re: DimStyleTableRecords
« Reply #23 on: November 10, 2007, 08:47:32 PM »
ahhh, I see what you mean.
looks like the style is not being correctly set current

after the netload, If you go into the DimStyleManager and manually set the style current it seems to work

similarly ; dim1 restore 1-1 does the same thing correctly.


Yeah I knew that would do it, but sending command strings during a reaction is a big no-no - thanks for confirming it.

That seems like a wobbly .. like for me to report it ?

Possibly Kerry, but have a look on ADN first if you can, for anything about working with DimStyles etc...we might be missing something blatantly obvious.

I was able to get around it by doing this. Not elegant by any stretch of the imagination, but maybe it's the only way.

Repeat the above steps and you should now end up with 1-1 with style overrides and the only override listed in the Dim Style Manager should be just the DIMSCALE value you set as an override on the previously current style.

Let me know how you go please Kerry.

Cheers,
Glenn.
« Last Edit: November 11, 2007, 08:13:26 AM by Glenn R »

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: DimStyleTableRecords
« Reply #24 on: November 10, 2007, 08:49:44 PM »
I had a look on ADN last night .. nothing obvious.

I'll go for a walk and have another look when I get back. ... and have a look at V3

added:
and Lorraine just put a batch of rock cakes in the oven .. I may have to go and supervise :lol:
« Last Edit: November 10, 2007, 08:59:16 PM by Kerry Brown »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Glenn R

  • Guest
Re: DimStyleTableRecords
« Reply #25 on: November 10, 2007, 09:08:50 PM »
Have one for me!

Glenn R

  • Guest
Re: DimStyleTableRecords
« Reply #26 on: November 11, 2007, 01:32:07 AM »
Heh...search long enough and you find it:

Code: [Select]
Database.SetDimstyleData(DimStyleTableRecord style)

Cheers,
Glenn.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: DimStyleTableRecords
« Reply #27 on: November 11, 2007, 01:43:32 AM »
Well done !

This has a lot of potential Glenn .. thanks for sharing.



"There is nothing like looking, if you are trying to find something..." ~B.Baggins
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Glenn R

  • Guest
Re: DimStyleTableRecords
« Reply #28 on: November 11, 2007, 01:48:09 AM »
Thanks Kerry - hope it's of some help in future.

Cheers,
Glenn.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: DimStyleTableRecords
« Reply #29 on: November 12, 2007, 11:46:21 AM »
Glad you found what you were looking for Glenn.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.