Anonymous
400 Views, 2 Replies
07-12-2016
06:27 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
07-12-2016
06:27 AM
Hi All,
i am writing a rule wich accsesses the parameters of the holefeatures in my parts.
When i use the code below on a part with a counterbore hole it only returns the parameter of the drilled part and ingnores the
depth and the diameter of the counterbore.
I attached the partfile with the rule.
SyntaxEditor Code Snippet
Dim oDoc as Inventor.PartDocument = ThisDoc.Document Dim oParam as Inventor.Parameter Dim oTol as Inventor.Tolerance Dim i As Integer Dim oFeat As PartFeature Dim oDim as FeatureDimension For i=1 To oDoc.ComponentDefinition.Features.count oFeat=oDoc.componentdefinition.Features.item(i) If oFeat.Type = 83912192 Then '83912192 = Holefeatures For n=1 To oFeat.FeatureDimensions.count oDim=oFeat.FeatureDimensions.item(n) oParam = oDim.Parameter MessageBox.Show(oFeat.Type & oParam.Name & oParam.Tolerance.HoleTolerance, " ", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1) Next End If Next
Solved! Go to Solution.
Anonymous
in reply to:
Anonymous
07-12-2016
07:11 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
07-12-2016
07:11 AM
Hi Udo.eckardt,
Welcome to the Comumunity!!
I hope the following code will be helpful for your requirement.
SyntaxEditor Code Snippet
Dim oPart As Document oPart = ThisApplication.ActiveDocument Dim oHoleFeature As HoleFeature For Each oHoleFeature In oPart.ComponentDefinition.Features.HoleFeatures Dim oHoleType As String If oHoleFeature.HoleType = 21507 Then oHoleType = "CounterBoreHole" ElseIf oHoleFeature.HoleType = 21506 Then oHoleType = "CounterSinkHole" ElseIf oHoleFeature.HoleType = 21505 Then oHoleType = "DrilledHole" ElseIf oHoleFeature.HoleType = 21508 Then oHoleType = "SpotFaceHole" End If MsgBox ("Counter bore Diameter: " & oHoleFeature.CBoreDiameter.Value & vbNewLine & _ "Counter Bore Depth: " & oHoleFeature.CBoreDepth.Value & vbNewLine & _ "Hole Type: " & oHoleType & vbNewLine & _ "Hole Name:" & oHoleFeature.Name & "") Next