Add New Dimension Style

Experimenter
Experimenter

Hellow

 

I try to add a new dimension style to a draft document.

My Code:

objDimStylesDFT.Add("NewDimst", objDimStyleDFT.Parent.ToString)

If I try to read the Parent like:

Value = objDimStyleDFT.Parent.ToString

I get the following Error:

HRESULT: 0x80040B54

 

Please help me

 

Basti

4 REPLIES

Re: Add New Dimension Style

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

Hi Basti,

don't use the Parent property (which should be the DraftDocument object, and is not definder at this time, because the new Style is not existing before creation...)

Use the name of an existing Styles in the list of DimensionStyles.

Is is used as a template for your new style (like in the user interface) and you only have to modify the properties that are different.

 

regards

Jürgen

regards

JB
VS2015, SE ST10

Re: Add New Dimension Style

Experimenter
Experimenter

I have to update Drafts witch have tree Styles up to five Styles!

I must add new Styles.

Copy from an old Style and Update is possible.

Re: Add New Dimension Style

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom
P.S.: if you pass an empty string to the parent parameter, SE will create a new style with default values. Otherwise the created style is dependent on the parent style.

This behaviour is like that in the user interface.
regards

JB
VS2015, SE ST10

Re: Add New Dimension Style

Experimenter
Experimenter

Thanks a lot

 

I search for a Parent like the Parent in the API. (Draft or something else)

So simple it can be.

Her we say: You can't see the forest in the mass of trees.