Change Dimension Style - iLogic

Change Dimension Style - iLogic

kresh.bell
Collaborator Collaborator
3,247 Views
12 Replies
Message 1 of 13

Change Dimension Style - iLogic

kresh.bell
Collaborator
Collaborator

Hi,

I have a very useful iLogic but it has a minor bug. Could someone fix that?
iLogic changes in all drawing sheets dimension style.  But If I have a chain dimension then it does not change the type of terminator, for example filed to oblique

 

before

2022-04-20_05-55-25.jpg

 

after run rule

2022-04-20_05-55-48.jpg

 

Dim oDDoc As DrawingDocument = ThisDrawing.Document
Dim oDStyle As DimensionStyle
For Each oDimStyle As DimensionStyle In oDDoc.StylesManager.DimensionStyles
	If oDimStyle.Name.Contains("Brigada Style 2") 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

 

Accepted solutions (1)
3,248 Views
12 Replies
Replies (12)
Message 2 of 13

Ralf_Krieg
Advisor
Advisor

Hello

 

This is a problem in your drawing style. Check in Style editor the selected option for "Internal Chain Terminator". Update style library and your drawing template after changing this value.

Chainterminator.jpg


R. Krieg
RKW Solutions
www.rkw-solutions.com
0 Likes
Message 3 of 13

kresh.bell
Collaborator
Collaborator

Hi Krieg,

thanks, but that's not a problem

 

2022-04-20_08-19-25.jpg2022-04-20_08-19-57.jpg2022-04-20_08-20-38.jpg2022-04-20_08-21-02.jpg

0 Likes
Message 4 of 13

Ralf_Krieg
Advisor
Advisor
Accepted solution

Hello

 

Sorry, thought this was a ChainDimensionSet. A single ChainDimension is like a normal linear dimension with overwritten arrows. Changing style does not change this overwritten values.

Try:

Dim oDDoc As DrawingDocument = ThisDrawing.Document
Dim oDStyle As DimensionStyle
For Each oDimStyle As DimensionStyle In oDDoc.StylesManager.DimensionStyles
	If oDimStyle.Name.Contains("Brigada Style 2") 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
		oGDim.FirstArrowheadType = kAsStyleArrowheadType
		oGDim.SecondArrowheadType = kAsStyleArrowheadType
	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

R. Krieg
RKW Solutions
www.rkw-solutions.com
Message 5 of 13

kresh.bell
Collaborator
Collaborator

Hi Krieg,

it's perfect now, thanks

0 Likes
Message 6 of 13

kresh.bell
Collaborator
Collaborator

Hi Krieg,

I have one more question.

 

Is it possible that same iLogic except dimension style, in all drawing sheets change Leader Style and Balloon Style?

 

kreshbell_0-1650779384983.png

 

0 Likes
Message 7 of 13

Ralf_Krieg
Advisor
Advisor

Hello

 

Yes, possible.

Dim oDDoc As DrawingDocument = ThisDrawing.Document
Dim oDStyle As DimensionStyle
For Each oDimStyle As DimensionStyle In oDDoc.StylesManager.DimensionStyles
	If oDimStyle.Name.Contains("Brigada Style 2") Then
		oDStyle = oDimStyle
	End If
Next
Dim oBStyle As BalloonStyle
For Each oBalloonStyle As BalloonStyle In oDDoc.StylesManager.BalloonStyles 
	If oBalloonStyle.Name.Contains("Brigada Style 2") Then
		oBStyle = oBalloonStyle
	End If
Next
Dim oFSyle As FeatureControlFrameStyle
For Each oFFrameStyle As FeatureControlFrameStyle In oDDoc.StylesManager.FeatureControlFrameStyles 
	If oFFrameStyle.Name.Contains("Brigada Style 2") Then
		oFStyle = oFFrameStyle
	End If
Next

Dim oSheet As Sheet
Dim oDims As DrawingDimensions
Dim oBalloons As Balloons
Dim oFFrames As FeatureControlFrames

For Each oSheet In oDDoc.Sheets
	oDims = oSheet.DrawingDimensions
	For Each oGDim As GeneralDimension In oDims.GeneralDimensions
		oGDim.Style = oDStyle
		oGDim.FirstArrowheadType = kAsStyleArrowheadType
		oGDim.SecondArrowheadType = kAsStyleArrowheadType
	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
	oBalloons = oSheet.Balloons
	For Each oBalloon As Balloon In oBalloons
		oBalloon.Style=oBStyle
	Next
	oFFrames = oSheet.FeatureControlFrames
	For Each offrame As FeatureControlFrame In oSheet.FeatureControlFrames
		offrame.Style = ofstyle
	Next	
Next

 

If you modify a lot of styles, think about adding a new standard (e.g. "Brigada Standard 2") with all your modifications. You should then be able to switch the active standard with one line of code and all the changes are applied at once.

 

Dim oDDoc As DrawingDocument = ThisDrawing.Document
Dim osStyle As DrawingStandardStyle
For Each oStandardStyle As DrawingStandardStyle In oDDoc.StylesManager.StandardStyles
	If oStandardStyle.Name.Contains("Brigada Standard 2") Then
		oDDoc.StylesManager.ActiveStandardStyle = oStandardStyle
	End If
Next

R. Krieg
RKW Solutions
www.rkw-solutions.com
0 Likes
Message 8 of 13

kresh.bell
Collaborator
Collaborator

Thanks a lot, is FrameStyles controlled by Leader Style?

kreshbell_0-1650782898499.png

 

0 Likes
Message 9 of 13

Ralf_Krieg
Advisor
Advisor

Hello

 

The FeatureControlFrameStyle uses a LeaderStyle for the leaders and a TextStyle for the text in a FeatureControlFrame.


R. Krieg
RKW Solutions
www.rkw-solutions.com
0 Likes
Message 10 of 13

kresh.bell
Collaborator
Collaborator

there is an error in line 47

kreshbell_0-1650784629785.png

 

 

0 Likes
Message 11 of 13

Ralf_Krieg
Advisor
Advisor

Hello

 

Is there no BalloonStyle "Brigada Style 2" present? You can make a short check if the new style is set, otherwise skip this part silently.

Dim oDDoc As DrawingDocument = ThisDrawing.Document
Dim oDStyle As DimensionStyle
For Each oDimStyle As DimensionStyle In oDDoc.StylesManager.DimensionStyles
	If oDimStyle.Name.Contains("Brigada Style 2") Then
		oDStyle = oDimStyle
	End If
Next
Dim oBStyle As BalloonStyle
For Each oBalloonStyle As BalloonStyle In oDDoc.StylesManager.BalloonStyles 
	If oBalloonStyle.Name.Contains("Brigada Style 2") Then
		oBStyle = oBalloonStyle
	End If
Next
Dim oFStyle As FeatureControlFrameStyle
For Each oFFrameStyle As FeatureControlFrameStyle In oDDoc.StylesManager.FeatureControlFrameStyles 
	If oFFrameStyle.Name.Contains("Brigada Style 2") Then
		oFStyle = oFFrameStyle
	End If
Next

Dim oSheet As Sheet
Dim oDims As DrawingDimensions
Dim oBalloons As Balloons
Dim oFFrames As FeatureControlFrames

For Each oSheet In oDDoc.Sheets
	If oDStyle IsNot Nothing Then
		oDims = oSheet.DrawingDimensions
		For Each oGDim As GeneralDimension In oDims.GeneralDimensions
			oGDim.Style = oDStyle
			oGDim.FirstArrowheadType = kAsStyleArrowheadType
			oGDim.SecondArrowheadType = kAsStyleArrowheadType
		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
	End If
	
	If oBStyle IsNot Nothing Then
		oBalloons = oSheet.Balloons
		For Each oBalloon As Balloon In oBalloons
			oBalloon.Style=oBStyle
		Next
	End If
	
	If oFStyle IsNot Nothing Then
		oFFrames = oSheet.FeatureControlFrames
		For Each oFFrame As FeatureControlFrame In oSheet.FeatureControlFrames
			oFFrame.Style = oFStyle
		Next
	End If
Next

 


R. Krieg
RKW Solutions
www.rkw-solutions.com
0 Likes
Message 12 of 13

kresh.bell
Collaborator
Collaborator

Krieg,

sorry for the delay, iLogic changed all dimensions style and baloon style but did not change leader style

 

before run rule

2022-04-25_07-52-50.jpg

 

after run rule

2022-04-25_07-53-26.jpg

0 Likes
Message 13 of 13

Ralf_Krieg
Advisor
Advisor

Hello

 

Added LeaderNote style change and removed some lines with less sense. As I said in my last post, think of creating a new standard. Creat it as copy of you current and change the object preferences. So you don't need to care of every single style change.

 

Dim oDDoc As DrawingDocument = ThisDrawing.Document
Dim oDStyle As DimensionStyle
For Each oDimStyle As DimensionStyle In oDDoc.StylesManager.DimensionStyles
	If oDimStyle.Name.Contains("Brigada Style 2") Then
		oDStyle = oDimStyle
	End If
Next
Dim oBStyle As BalloonStyle
For Each oBalloonStyle As BalloonStyle In oDDoc.StylesManager.BalloonStyles 
	If oBalloonStyle.Name.Contains("Brigada Style 2") Then
		oBStyle = oBalloonStyle
	End If
Next
Dim oFStyle As FeatureControlFrameStyle
For Each oFFrameStyle As FeatureControlFrameStyle In oDDoc.StylesManager.FeatureControlFrameStyles 
	If oFFrameStyle.Name.Contains("Brigada Style 2") Then
		oFStyle = oFFrameStyle
	End If
Next
Dim oLStyle As LeaderStyle
For Each oLeaderStyle As LeaderStyle In oDDoc.StylesManager.LeaderStyles 
	If oLeaderStyle.Name.Contains("Brigada Style 2") Then
		oLStyle = oLeaderStyle
	End If
Next

Dim oSheet As Sheet
Dim oDims As DrawingDimensions
Dim oBalloons As Balloons
Dim oFFrames As FeatureControlFrames
Dim oLeaderNotes As LeaderNotes

For Each oSheet In oDDoc.Sheets
	If oDStyle IsNot Nothing Then
		oDims = oSheet.DrawingDimensions
		For Each oGDim As GeneralDimension In oDims.GeneralDimensions
			oGDim.Style = oDStyle
			oGDim.FirstArrowheadType = kAsStyleArrowheadType
			oGDim.SecondArrowheadType = kAsStyleArrowheadType
		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
	End If
	
	If oBStyle IsNot Nothing Then
		For Each oBalloon As Balloon In oSheet.Balloons
			oBalloon.Style=oBStyle
		Next
	End If
	
	If oFStyle IsNot Nothing Then
		For Each oFFrame As FeatureControlFrame In oSheet.FeatureControlFrames
			oFFrame.Style = oFStyle
		Next
	End If
	
	If oLStyle IsNot Nothing Then
		For Each oLeaderNote As LeaderNote In oSheet.DrawingNotes.LeaderNotes
			oLeaderNote.DimensionStyle.LeaderStyle = oLStyle
		Next
	End If
Next

R. Krieg
RKW Solutions
www.rkw-solutions.com