Change dimension style on all sheets

Change dimension style on all sheets

kresh.bell
Collaborator Collaborator
853 Views
5 Replies
Message 1 of 6

Change dimension style on all sheets

kresh.bell
Collaborator
Collaborator

Hi,

is it possible to make a logic that will select and change dimension style on all sheets, eg. I want to change the dimension style on all sheets, eg on 50 of them

0 Likes
Accepted solutions (1)
854 Views
5 Replies
Replies (5)
Message 2 of 6

WCrihfield
Mentor
Mentor

Would something like this work for you?

You would of course, have to set the style you want in a slightly different way.

 

 

Dim oDDoc As DrawingDocument = ThisDrawing.Document
Dim oDStyle As DimensionStyle = oDDoc.StylesManager.DimensionStyles.Item(1)
Dim oSheet As Sheet
Dim oDims As DrawingDimensions
For Each oSheet In oDDoc.Sheets
	oDims = oSheet.DrawingDimensions
	For Each oGDim As GeneralDimension In oDims.GeneralDimensions
		oGDim.Style = oDStyle
	Next
	For Each oODim As OrdinateDimension In oDims.OrdinateDimensions
		oODim.Style = oDStyle
	Next
	For Each oODimSet As OrdinateDimensionSet In oDims.OrdinateDimensionSets
		oODimSet.Style = oDStyle
	Next
	For Each oCHDimSet As ChainDimensionSet In oDims.ChainDimensionSets
		oCHDimSet.Style = oDStyle
	Next
	For Each oBLDimSet As BaselineDimensionSet In oDims.BaselineDimensionSets
		oBLDimSet.Style = oDStyle
	Next
Next

 

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 6

WCrihfield
Mentor
Mentor

@kresh.bell 

You could replace the line

Dim oDStyle As DimensionStyle = oDDoc.StylesManager.DimensionStyles.Item(1)

with something like this

Dim oDStyle As DimensionStyle
For Each oDimStyle As DimensionStyle In oDDoc.StylesManager.DimensionStyles
	If oDimStyle.Name.Contains("Something") Then
		oDStyle = oDimStyle
	End If
Next

and replace "Something" with the name of the dimension style you want. 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 4 of 6

kresh.bell
Collaborator
Collaborator

I'm doing something wrong, I'm getting an error, the dimension style is called PRL_Style

 

prl.jpg

0 Likes
Message 5 of 6

WCrihfield
Mentor
Mentor
Accepted solution

I see it.  Within the loop searching for the dimension style by that name, you're using

Contains.RPL_Style Then

It should be

Contains("RPL_Style") Then

Like this:

Dim oDDoc As DrawingDocument = ThisDrawing.Document
Dim oDStyle As DimensionStyle
For Each oDimStyle As DimensionStyle In oDDoc.StylesManager.DimensionStyles
	If oDimStyle.Name.Contains("RPL_Style") Then
		oDStyle = oDimStyle
	End If
Next
Dim oSheet As Sheet
Dim oDims As DrawingDimensions
For Each oSheet In oDDoc.Sheets
	oDims = oSheet.DrawingDimensions
	For Each oGDim As GeneralDimension In oDims.GeneralDimensions
		oGDim.Style = oDStyle
	Next
	For Each oODim As OrdinateDimension In oDims.OrdinateDimensions
		oODim.Style = oDStyle
	Next
	For Each oODimSet As OrdinateDimensionSet In oDims.OrdinateDimensionSets
		oODimSet.Style = oDStyle
	Next
	For Each oCHDimSet As ChainDimensionSet In oDims.ChainDimensionSets
		oCHDimSet.Style = oDStyle
	Next
	For Each oBLDimSet As BaselineDimensionSet In oDims.BaselineDimensionSets
		oBLDimSet.Style = oDStyle
	Next
Next

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 6 of 6

kresh.bell
Collaborator
Collaborator

Hi,

works great, thanks !!!

0 Likes