iLogic - Code to add a specific tolerance to a selected hole

iLogic - Code to add a specific tolerance to a selected hole

tdswanson
Collaborator Collaborator
3,086 Views
12 Replies
Message 1 of 13

iLogic - Code to add a specific tolerance to a selected hole

tdswanson
Collaborator
Collaborator

With the help of a few folks on this forum, I was able to create a small utility to apply a standard set of tolerances to dowel holes.  Since I'm in the tool and die business, we pin a lot of components in place.  So I wanted to be able to select some specific press fit holes and apply a H6 tolerance to them en masse.  I also wanted to do the same thing with a "deviation" tolerance of +0.001" / -0.000" to any slip fit holes.  

 

Anyway, here's the code for the press fit version:

 

Dim oDoc As Document
	oDoc = ThisApplication.ActiveEditDocument
Dim i As Integer
	i = 1
Dim Proceed As Integer
Dim FeatureCount As Integer
Dim HoleModCount As Integer
If ThisDoc.Document.SelectSet.count <1 Then ' Verify the total number of selected features
	q = MessageBox.Show("You must select at least one hole.", "iLogic Error", MessageBoxButtons.OK, MessageBoxIcon.asterisk, MessageBoxDefaultButton.Button1)
	Exit Sub
End If
FeatureCount = ThisDoc.Document.SelectSet.count ' Store the total number of selected features
HoleModCount = 0 ' Zero the counter for modified holes
	'For Each CurrentHole As HoleFeature In oDoc.ComponentDefinition.Features.HoleFeatures ' Run on ALL Holes
	'For Each CurrentHole As HoleFeature In ThisDoc.Document.SelectSet ' Run on SELECTED Holes
	For Each CurrentHole In ThisDoc.Document.SelectSet ' Run on SELECTED Features
		'If CurrentHole.Suppressed = False Then Proceed = 0 'Run command on suppressed features
		Proceed = 0 ' Green light variable
		If CurrentHole.Type = ObjectTypeEnum.kHoleFeatureObject Then ' Check to make sure this feature is a hole
			Proceed = 1 ' Green light
			If CurrentHole.Tapped = True Then Proceed = 0 ' Cancel if a tapped hole
		Else 
			Proceed = 0 ' Red light if the feature isn't a hole
		End If
			If Proceed = 1 Then
				Dim oDef As PartComponentDefinition
				oDef = oDoc.ComponentDefinition
				Dim oHole(i) As HoleFeature
				oHole(i) = oDef.Features.HoleFeatures.Item(i)
				Dim oDiamParam(i) As Parameter
				oDiamParam(i) = oHole(i).HoleDiameter
				Dim oTol(i) As Tolerance
				oTol(i) = oDiamParam(i).Tolerance
				If oTol(i).ToleranceType() = 31233 Then ' If the hole currently has a default tolerance
					oTol(i).SetToFits(31244,("H6"),("")) ' Modify the hole tolerance
					HoleModCount = HoleModCount + 1 ' Bump the counter
					InventorVb.DocumentUpdate() ' Update Doc
				End If
			End If
	Next CurrentHole ' Next Feature
q = MessageBox.Show(FeatureCount & " features were selected.  " & HoleModCount & " hole(s) were modified.  ", "iLogic Summary", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1)
oDoc.Update()
'Reference Info:
'Const kBasicTolerance = 31245
'Const kDefaultTolerance = 31233
'Const kDeviationTolerance = 31236
'Const kLimitLinearTolerance = 31238
'Const kLimitsFitsLinearTolerance = 31242
'Const kLimitsFitsShowSizeTolerance = 31243
'Const kLimitsFitsShowTolerance = 31244
'Const kLimitsFitsStackedTolerance = 31241
'Const kLimitsStackedTolerance = 31237
'Const kMaxTolerance = 31239
'Const kMinTolerance = 31240 
'Const kOverrideTolerance = 31234 
'Const kReferenceTolerance = 31246 
'Const kSymmetricTolerance = 31235

And here's the code for the slip fit version:

 

Dim oDoc As Document
	oDoc = ThisApplication.ActiveEditDocument
Dim i As Integer
	i = 1
Dim Proceed As Integer
Dim FeatureCount As Integer
Dim HoleModCount As Integer
If ThisDoc.Document.SelectSet.count <1 Then ' Verify the total number of selected features
	q = MessageBox.Show("You must select at least one hole.", "iLogic Error", MessageBoxButtons.OK, MessageBoxIcon.asterisk, MessageBoxDefaultButton.Button1)
	Exit Sub
End If
FeatureCount = ThisDoc.Document.SelectSet.count ' Store the total number of selected features
HoleModCount = 0 ' Zero the counter for modified holes
	'For Each CurrentHole As HoleFeature In oDoc.ComponentDefinition.Features.HoleFeatures ' Run on ALL Holes
	'For Each CurrentHole As HoleFeature In ThisDoc.Document.SelectSet ' Run on SELECTED Holes
	For Each CurrentHole In ThisDoc.Document.SelectSet ' Run on SELECTED Features
		'If CurrentHole.Suppressed = False Then Proceed = 0 'Run command on suppressed features
		Proceed = 0 ' Green light variable
		If CurrentHole.Type = ObjectTypeEnum.kHoleFeatureObject Then ' Check to make sure this feature is a hole
			Proceed = 1 ' Green light
			If CurrentHole.Tapped = True Then Proceed = 0 ' Cancel if a tapped hole
		Else 
			Proceed = 0 ' Red light if the feature isn't a hole
		End If

			If Proceed = 1 Then
				Dim oDef As PartComponentDefinition
				oDef = oDoc.ComponentDefinition
				Dim oHole(i) As HoleFeature
				oHole(i) = oDef.Features.HoleFeatures.Item(i)
				Dim oDiamParam(i) As Parameter
				oDiamParam(i) = oHole(i).HoleDiameter
				Dim oTol(i) As Tolerance
				oTol(i) = oDiamParam(i).Tolerance
				If oTol(i).ToleranceType() = 31233 Then ' If the hole currently has a default tolerance
					oTol(i).SetToDeviation("0.001 in","0.0 in") ' Modify the hole tolerance
					HoleModCount = HoleModCount + 1 ' Bump the counter
					InventorVb.DocumentUpdate() ' Update Doc
				End If
		End If
	Next CurrentHole 'Next Feature
q = MessageBox.Show(FeatureCount & " features were selected.  " & HoleModCount & " hole(s) were modified.  ", "iLogic Summary", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1)
oDoc.Update()

'Reference Info:
'Const kBasicTolerance = 31245
'Const kDefaultTolerance = 31233
'Const kDeviationTolerance = 31236
'Const kLimitLinearTolerance = 31238
'Const kLimitsFitsLinearTolerance = 31242
'Const kLimitsFitsShowSizeTolerance = 31243
'Const kLimitsFitsShowTolerance = 31244
'Const kLimitsFitsStackedTolerance = 31241
'Const kLimitsStackedTolerance = 31237
'Const kMaxTolerance = 31239
'Const kMinTolerance = 31240 
'Const kOverrideTolerance = 31234 
'Const kReferenceTolerance = 31246 
'Const kSymmetricTolerance = 31235

 

3,087 Views
12 Replies
Replies (12)
Message 2 of 13

Curtis_Waguespack
Consultant
Consultant

Hi tdswanson,

 

Hey thanks for providing the working code. I'm sure it'll help someone in the future.

 

To that point, attached is a 2015 file with based on your rules, using the selection filter example provided in the other thread.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

' Set a reference to the active part document.
Dim oDoc As PartDocument
oDoc = ThisApplication.ActiveDocument
oSet = oDoc.CreateHighlightSet

'select holes
While True
  Dim oFeature As Object
    oFeature = ThisApplication.CommandManager.Pick(
      SelectionFilterEnum.kPartFeatureFilter, 
      "Select Hole Features (press ESC to continue)") 
	
	' If nothing gets selected then we're done	
	If IsNothing(oFeature) Then Exit While
	
	If TypeOf oFeature Is HoleFeature Then 
    	oSet.AddItem(oFeature)
	End If
End While

oSelected = oSet.Count

'modify holes
Dim oDef As PartComponentDefinition
oDef = oDoc.ComponentDefinition
Dim oHole As HoleFeature

HoleModCount = 0
For Each oHole In oSet
	Dim oDiamParam As Parameter
	oDiamParam = oHole.HoleDiameter
	Dim oTol As Tolerance
	oTol = oDiamParam.Tolerance
	' If the hole is not fits tolerance
	If oTol.ToleranceType() <> oTol.ToleranceType.kLimitsFitsShowTolerance  Then 
		'Modify the hole tolerance
		oTol.SetToFits(oTol.ToleranceType.kLimitsFitsShowTolerance,("H6"),("")) 
		' Bump the counter
		HoleModCount = HoleModCount + 1 		
	End If
Next

'present message to user
MessageBox.Show(oSelected & " hole(s) were selected.  " & vbLf & _
HoleModCount & " hole(s) were modified.  ", "iLogic Summary", _
MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1)

'clear the selection set
oSet.Clear

' Update Doc
InventorVb.DocumentUpdate() 
				

 

 

EESignature

Message 3 of 13

ralfmja
Advocate
Advocate

Hello @Curtis_Waguespack , @tdswanson ,

 

I know the topic is old but a great solution was made by Curtis.

 

Unfortunately, I noticed one undesirable action.

 

After making the drawing for the part, saving it and trying to change the tolerance according to your codes - this tolerance in the drawing does not update. To better describe what I mean, I recorded a gif.

 

The only way I found it was to open the tolerance window (picture below) and click OK (just open this window for one hole and everything updates).

 

obraz.png

 

It is possible that this is some way to solve the problem (adding in the opening and confirmation code OK in this window) but I would like to ask you to look at this problem 🙂

 

I attached the idw file to better understanding.

 

Thank you in advance,

Regards,

Ralfmj

0 Likes
Message 4 of 13

Curtis_Waguespack
Consultant
Consultant

Hi @ralfmja ,

 

I looked at this briefly, but adding something to "hit" the Hole Diameter value seems to resolve the issue.

 

You would add something like the lines in red to each of the different rules in the example file.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

HoleModCount = 0
For Each oHole In oSet
	Dim oDiamParam As Parameter
	oDiamParam = oHole.HoleDiameter
	Dim oTol As Tolerance
	oTol = oDiamParam.Tolerance
	' If the hole is not deviation tolerance
	If oTol.ToleranceType() <> oTol.ToleranceType.kDeviationTolerance  Then 
		'Modify the hole tolerance
		oTol.SetToDeviation("0.001 in","0.0 in")
		' Bump the counter
		HoleModCount = HoleModCount + 1 		
	End If
	
	'hit the diameter value to get it to refresh
	oDiamParam.Value = oDiamParam.Value	 
Next

EESignature

0 Likes
Message 5 of 13

ralfmja
Advocate
Advocate

Hi @Curtis_Waguespack 

 

Works great !!

 

Thank you,

ralfmj

0 Likes
Message 6 of 13

ralfmja
Advocate
Advocate

Hi @Curtis_Waguespack,

 

I changed the rule to select all holes and if it finds holes with diameters 3, 4, 5, 6, 8, 10, 12 then it sets the tolerances to H7. In addition, I had to introduce protection before choosing a threaded hole.

 

I managed and the rule works - unfortunately not quite 🙂

 

Can you explain to me why it omits holes with diameters of 3, 6 and 12mm ??

 

code below after my modifications:

 

' Set a reference to the active part document.
Dim oDoc As PartDocument
oDoc = ThisApplication.ActiveDocument

oSet = oDoc.CreateHighlightSet

'domyślna tolerancja
oDefault = "H7"

'select holes

  Dim oFeature As HoleFeature 
  For Each oFeature In oDoc.ComponentDefinition.Features.HoleFeatures
			oSet.AddItem(oFeature)
Next


oSelected = oSet.Count


'modify holes
Dim oDef As PartComponentDefinition
oDef = oDoc.ComponentDefinition
Dim oHole As HoleFeature

HoleModCount = 0

For Each oHole In oSet
		If oHole.Tapped <> True then
			Dim oDiamParam As Parameter
			oDiamParam = oHole.HoleDiameter
			CurrDiam = oDiamParam.Value * 10
			Dim oTol As Tolerance
			oTol = oDiamParam.Tolerance
			'MsgBox(oDiamParam.Value)
	
			If CurrDiam = 3 Then
				oTol.SetToFits(oTol.ToleranceType.kLimitsFitsShowTolerance, (oDefault), (""))
				HoleModCount = HoleModCount + 1
				oDiamParam.Value = oDiamParam.Value
			Else If CurrDiam = 4 Then
				oTol.SetToFits(oTol.ToleranceType.kLimitsFitsShowTolerance, (oDefault), (""))
				HoleModCount = HoleModCount + 1
				oDiamParam.Value = oDiamParam.Value
			Else If CurrDiam = 5 Then
				oTol.SetToFits(oTol.ToleranceType.kLimitsFitsShowTolerance, (oDefault), (""))
				HoleModCount = HoleModCount + 1
				oDiamParam.Value = oDiamParam.Value
			Else If CurrDiam = 6 Then
				oTol.SetToFits(oTol.ToleranceType.kLimitsFitsShowTolerance, (oDefault), (""))
				HoleModCount = HoleModCount + 1
				oDiamParam.Value = oDiamParam.Value
			Else If CurrDiam = 8 Then
				oTol.SetToFits(oTol.ToleranceType.kLimitsFitsShowTolerance, (oDefault), (""))
				HoleModCount = HoleModCount + 1
				oDiamParam.Value = oDiamParam.Value
			Else If CurrDiam = 10 Then
				oTol.SetToFits(oTol.ToleranceType.kLimitsFitsShowTolerance, (oDefault), (""))
				HoleModCount = HoleModCount + 1
				oDiamParam.Value = oDiamParam.Value
			Else If CurrDiam = 12 Then
				oTol.SetToFits(oTol.ToleranceType.kLimitsFitsShowTolerance, (oDefault), (""))
				HoleModCount = HoleModCount + 1
				oDiamParam.Value = oDiamParam.Value
			Else
			End if
	oDiamParam.Value = oDiamParam.Value	
		End If	
	
Next

'present message to user
MessageBox.Show(oSelected & " otworów wybrano.  " & vbLf & _
HoleModCount & " otworów zmodyfikowano.  ", "PODSUMOWANIE", _
MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1)

'clear the selection set
oSet.Clear

' Update Doc
InventorVb.DocumentUpdate() 

I attach example ipt with diffrent hole to test and gif with explanation.

 

 

Thanks in advance,

ralfmj

0 Likes
Message 7 of 13

Curtis_Waguespack
Consultant
Consultant

Hi @ralfmja 

 

I think the issue was in how the variable CurrDiam was being defined (or not defined) ... I didn't look to see what it was seeing, or why, but it was seeing a type mismatch ... meaning that it was seeing 3 as a double or a string or something ... anyway the fix was to define CurrDiam as an Integer.

 

I did take a moment to condense your code, there was nothing wrong with what you had. ....I just discarded and condensed it as a process of elimination and ended up with this, before realizing that defining the CurrDiam variable as an integer was the solution.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

' Set a reference to the active part document.
Dim oDoc As PartDocument
oDoc = ThisApplication.ActiveDocument
Dim oDef As PartComponentDefinition
oDef = oDoc.ComponentDefinition

'domyślna tolerancja
oDefault = "H7"

'modify holes
HoleModCount = 0
oSelected = 0
Dim CurrDiam As Integer

Dim oHole As HoleFeature
For Each oHole In oDef.Features.HoleFeatures

	If oHole.Tapped <> True Then
		oSelected = oSelected+1
		Dim oDiamParam As Parameter
		oDiamParam = oHole.HoleDiameter
		CurrDiam = oDiamParam.Value * 10			
		Dim oTol As Tolerance
		oTol = oDiamParam.Tolerance
		'MsgBox(CurrDiam)
		
		'create list of diameters to change
		Dim oChangeList = New Integer(){3, 4, 5, 6, 8, 10, 12}
		
		'check current diameter against list
		If oChangeList.Contains(CurrDiam) = True Then
			oTol.SetToFits(oTol.ToleranceType.kLimitsFitsShowTolerance, (oDefault), (""))
			HoleModCount = HoleModCount + 1
			oDiamParam.Value = oDiamParam.Value
		End If
		
	End If	
	
Next

'present message to user
MessageBox.Show(oSelected & " otworów wybrano.  " & vbLf & _
HoleModCount & " otworów zmodyfikowano.  ", "PODSUMOWANIE", _
MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1)


' Update Doc
InventorVb.DocumentUpdate() 

EESignature

0 Likes
Message 8 of 13

ralfmja
Advocate
Advocate

@Curtis_Waguespack,

 

Thank you because you showed me the way to follow.

 

However, I think I need to change the integer variable to e.g. decimal because the diameter is not always an integer.

 

Thanks for the quick hint,

Regards,

ralfmj

0 Likes
Message 9 of 13

Curtis_Waguespack
Consultant
Consultant

Hi @ralfmja ,

 

I think you could change it to be a Double or a String as well, just as long as it matches they type. In this example I used String.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

' Set a reference to the active part document.
Dim oDoc As PartDocument
oDoc = ThisApplication.ActiveDocument
Dim oDef As PartComponentDefinition
oDef = oDoc.ComponentDefinition

'domyślna tolerancja
oDefault = "H7"

'modify holes
HoleModCount = 0
oSelected = 0
Dim CurrDiam As String

Dim oHole As HoleFeature
For Each oHole In oDef.Features.HoleFeatures
	If oHole.Tapped <> True Then
		oSelected = oSelected+1
		Dim oDiamParam As Parameter
		oDiamParam = oHole.HoleDiameter
		CurrDiam = oDiamParam.Value * 10			
		Dim oTol As Tolerance
		oTol = oDiamParam.Tolerance
		'MsgBox(CurrDiam)
		'create list of diameters to change
		Dim oChangeList = New String(){3,3.5, 4, 5, 6, 8, 10, 12}
		

		'check current diameter against list
		If oChangeList.Contains(CurrDiam) = True Then
			oTol.SetToFits(oTol.ToleranceType.kLimitsFitsShowTolerance, (oDefault), (""))
			HoleModCount = HoleModCount + 1
			oDiamParam.Value = oDiamParam.Value
		End If
		
	End If	
	
Next

'present message to user
MessageBox.Show(oSelected & " otworów wybrano.  " & vbLf & _
HoleModCount & " otworów zmodyfikowano.  ", "PODSUMOWANIE", _
MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1)


' Update Doc
InventorVb.DocumentUpdate() 

EESignature

0 Likes
Message 10 of 13

ralfmja
Advocate
Advocate

Hi @Curtis_Waguespack ,

 

Everything ok - thank you !!

 

I would like to take this opportunity to ask you about one more issue 😀

 

I would like to add code in the same rule that would color the holes depending on the tolerance.

 

This would work as follows:

 

If the hole has tolerances H7, H6 generally the SetToFits tolerance type then all holes are e.g. color (255,0,0) if the tolerance is of type SetTodefault () then the holes are color e.g. (12,255,0) like on screen below:

obraz.png

 

It is important for me that when you later save this element to the STP file - the colors were also visible in it 🙂

 

Thanks in advance,

Regards,

ralfmj

0 Likes
Message 11 of 13

Curtis_Waguespack
Consultant
Consultant

@ralfmja wrote:

Hi @Curtis_Waguespack ,

 

Everything ok - thank you !!

 

I would like to take this opportunity to ask you about one more issue 😀

 

I would like to add code in the same rule that would color the holes depending on the tolerance.

 

This would work as follows:

 

If the hole has tolerances H7, H6 generally the SetToFits tolerance type then all holes are e.g. color (255,0,0) if the tolerance is of type SetTodefault () then the holes are color e.g. (12,255,0) like on screen below:

 

 

It is important for me that when you later save this element to the STP file - the colors were also visible in it 🙂

 

Thanks in advance,

Regards,

ralfmj



Hi @ralfmja ,

here are some links that deal with creating colors, one sets the color to a named appearance color and the other sets RGB color.

 

https://www.cadlinecommunity.co.uk/hc/en-us/articles/203089261-Inventor-2015-iLogic-Set-colour-of-fe...

https://www.cadlinecommunity.co.uk/hc/en-us/articles/203443221-Inventor-2016-iLogic-Slider-for-Part-...

 

 

 

EESignature

0 Likes
Message 12 of 13

ralfmja
Advocate
Advocate

Hi @Curtis_Waguespack ,

 

Many thanks to show me the way.

 

I prepare some code (maybe not perfect but works) :

 

 

' Ustawienie dokumentu jako aktywny
Dim tobjs As TransientObjects = ThisApplication.TransientObjects
Dim oDoc As PartDocument
oDoc = ThisApplication.ActiveDocument
Dim oDef As PartComponentDefinition
oDef = oDoc.ComponentDefinition

'sprawdzenie czy dokument w którym reguła ma działać to dokument edytowalny
Try
oDoc = ThisApplication.ActiveEditDocument
Catch
MsgBox("Reguła działa dla części. Otwórz jakikolwiek plik ipt")
End Try

'deklaracja wyglądów
Dim oDocAssets As Assets = oDoc.Assets
Dim App1 As Asset = Nothing
Dim App2 As Asset = Nothing

Try ' sprawdzenie czy wygląd istnieje
App1 = oDocAssets.Item("CZERWIEN")
Catch ' jesli nie istnieje to stworzenie go
App1 = oDocAssets.Add(AssetTypeEnum.kAssetTypeAppearance, "Generic", "kolor czerowny", "CZERWIEN")
End Try

Try ' sprawdzenie czy wygląd istnieje
App2 = oDocAssets.Item("ZIELEN")
Catch ' jesli nie istnieje to stworzenie go
App2 = oDocAssets.Add(AssetTypeEnum.kAssetTypeAppearance, "Generic", "kolor zielony", "ZIELEN")
End Try


'stworzenie koloru czerwonego
Dim color1 As ColorAssetValue = App1.Item("generic_diffuse")
color1.Value = tobjs.CreateColor(255, 0, 0)

'Stworzenie koloru zielonego
Dim color2 As ColorAssetValue = App2.Item("generic_diffuse")
color2.Value = tobjs.CreateColor(12, 255, 0)

'modify holes
oSelected = 0
Dim CurrDiam As Decimal

Dim oHole As HoleFeature
For Each oHole In oDef.Features.HoleFeatures

	If oHole.Tapped <> True Then
		If oHole.HoleType = 21507 Then
				Dim oDiamParam As Parameter
				oDiamParam = oHole.HoleDiameter
				Dim oTol As Tolerance
				oTol = oDiamParam.Tolerance
				Dim oDiamCboreParam As Parameter
				oDiamCboreParam = oHole.CBoreDiameter
				Dim oTolCbore As Tolerance
				oTolCbore = oDiamCboreParam.Tolerance
					If oTol.ToleranceType <> kDefaultTolerance Or oTolCbore.ToleranceType <> kDefaultTolerance Then
						oHole.Appearance = App1
					Else 
						oHole.Appearance = App2
					End If
		Else 
'				oSelected = oSelected + 1
				Dim oDiamParam As Parameter
				oDiamParam = oHole.HoleDiameter			
				Dim oTol As Tolerance
				oTol = oDiamParam.Tolerance
					If oTol.ToleranceType <> kDefaultTolerance Then
						oHole.Appearance = App1
					Else
						oHole.Appearance = App2
					End If
				
		End If	
	End If
	
Next



' Update Doc
InventorVb.DocumentUpdate() 

I have two additional question and it's possible that someone will be so kind and explain it to me 🙂

 

 

1. What is it "generic_diffuse" in line :

 

Dim color2 As ColorAssetValue = App2.Item("generic_diffuse")

I guess this is some "property" of the assets.add method when it comes to the LocalType parameter (in this case for "GENERIC" screenshot below) but I can't find anything in the API help (I may be looking wrong)

 

obraz.png

 

2. I also have a problem to color the holes made with Pattern Components (the first is ok but the rest is in the default color - screen below). You can lead me to solve this problem. I think you need to check if the pattern component has holes and what. Then color all of the pattern component feature in the color of the first occurrence. Unfortunately, I don't know how to go about it 😐

obraz.png

 

Thanks in advance,

Regards,

ralfmj

0 Likes
Message 13 of 13

maxim.teleguz
Advocate
Advocate

How can we change the precision of a hole note in Ilogic inside a drawing?

 

this is how far i got:

 

Dim odim As DrawingDimension
Line1 :
'odim = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingDimensionFilter, "Select Dimension")
odim = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAllEntitiesFilter, "Select Dimension")
If odim Is Nothing Then
	Exit Sub
Else
	odim.Precision = 3
	If TypeOf odim Is HoleThreadNote = True Then
		Dim oHNote As HoleThreadNote = odim
		MsgBox(oHNote.FormattedHoleThreadNote, , "")
		a = InputBox("","FormattedHoleThreadNote", oHNote.FormattedHoleThreadNote)
		'oHNote.FormattedHoleThreadNote = "<HoleProperty HolePropertyID='kHoleDiameterHoleProperty' Precision='3' AlternatePrecision='3'</HoleProperty>"
	End If

End If
GoTo Line1 

 

0 Likes