Dimstyle

#1
John,

I am having trouble changing to another dimstyle name without making dimensional "overrides". The method I used to change dimstyle is listed below:

mydoc.ActiveDimStyle = mystyles.Item(dimname)

dimname is selected from a combobox
mystyles is a collection of the dimension styles in the drawing.

This works except that Icad places a dimension override under the style changed to (dimname) and copies the properties of the previous dimension style (not that of dimname),No dimension settings have been changed prior to setting the activedimstyle, what is going on?????????? Why the overrides?? Why doesn't Icad just change to the new dimension style??

(I know they are not the same but this works in AutoCad).

Your help is greatly appreciated.

Thank you,

Scott

#2
Scott,

Try:

mydoc.ActiveDimStyle.Name = mystyles.Item(dimname)

I think your overrides problem comes from the fact that you are supplying the pointer to Object and not the name property.


------------------
Regards
John Finlay
Don't want to post a question - email me direct on john@acecad.com.au

#3
John,

I can't figure this out. I must be doing something wrong or there is a bug. I have tried all sorts of things one is as follows

Sub dimstyleload() 'Load Drawing Dimstyles in form
Dim mystyles As DimensionStyles
Dim mydimstyle As dimensionstyle
Dim i As Single
Set mydoc = intellicad.ActiveDocument
Set mystyles = mydoc.DimensionStyles

i = 0
For Each mydimstyle In mystyles
cbodimstyle.AddItem mystyles.Item(mydimstyle.Name)
cbodimstyle.List(i, 1) = mydimstyle.Name
i = i + 1
cbodimstyle.TextColumn = 2

Next


End Sub

Private Sub cboDimStyle_click()
Dim mystyles As DimensionStyles
Dim mydimstyle As dimensionstyle
Set mydoc = intellicad.ActiveDocument
Set mystyles = mydoc.DimensionStyles
Set mydimstyle = mydoc.ActiveDimStyle
mydimstyle.Name = cbodimstyle.Text
mydoc.ActiveDimStyle.Name = mystyles.Item(cbodimstyle.Text)

End Sub

Notice the cboDimstyle additem and the List line are adding the same thing mydimstyles.name, however the combobox shows the dimension style handle instead of the name in column 1???

Also, if the the dimension style is changed via the activedimstyle command it will override the dimension if the name is used but will rename the current dimension if the handle is used???????? This is very strange.

Any other suggestions??

Thank you,

Scott

#4
Scott,

To load the DimStyle Names in your combo box try:

Private Sub UserForm_Initialize()
Dim i As Integer

'Loop from 1 to the total number of DimensionStyles
For i = 1 To IntelliCAD.ActiveDocument.DimensionStyles.Count
'Add each DimensionStyle name to the combo box
cboDimstyle.AddItem IntelliCAD.ActiveDocument.DimensionStyles.Item(i).Name
Next i

End Sub



------------------
Regards
John Finlay
Don't want to post a question - email me direct on john@acecad.com.au

#5
John,

Thank you for the response.

The method you stated works good for the loading of the combobox.

However, I still get the same problem with the dimension overrides. If I use the following:

IntelliCAD.ActiveDocument.ActiveDimStyle = IntelliCAD.ActiveDocument.DimensionStyles.Item(i) 'i being the index for the proper dimension style selected from the combobox

Intellicad will copy the current (or active) dimension settings and apply it to the dimension style that is selected (item(i)).

If the following method is used:

IntelliCAD.ActiveDocument.ActiveDimStyle.Name = IntelliCAD.ActiveDocument.DimensionStyles.Item(i).Name

Intellicad will rename the dimension style.

I do not believe this is supposed to happen. The object browser says that ActiveDimStyle sets or returns the current dimstyle.

Am I still doing something wrong or is there a problem with VBA or the Dimensioning in Intellicad??

Please help.

Thank you,

Scott

#6
John,

Have you verified this action? Do you have any thoughts as to how to change the active dimension style (change to a style already in drawing and use its settings) without producing "overrides"?

Thank you,

Scott

[This message has been edited by Scott (edited 02-13-2002).]

#8
John,

I know you are busy, just checking to see if you had an opportunity to verify this problem.

I noticed the post with regards to rotated dimensions. Does the same apply here?

Thank you again,

Scott