- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I just wanted to create a punchtool on a point . There type missmatch i dont understand why , if some one could help me i would very helpfull .
Sub Bohrungen()
'set a reference to active document
Dim oPartDoc As PartDocument
Set oPartDoc = ThisApplication.ActiveDocument
' set a reference to shett metal metal definition
Dim oShMetDef As SheetMetalComponentDefinition
Set oShMetDef = oPartDoc.ComponentDefinition
'assume a face has been selected in the part
Dim oFace As Face
Set oFace = oPartDoc.SelectSet(1)
'Set reference to the transient geometry
Dim oTG As TransientGeometry
Set oTG = ThisApplication.TransientGeometry
'Make sure it is a planar face
If oFace.SurfaceType = kPlaneSurface Then
Dim oPlanarSurface As Plane
Set oPlanarSurface = oFace.Geometry
Dim oSketch As PlanarSketch
Set oSketch = oShMetDef.Sketches.Add(oFace)
Dim oPoint1 As SketchPoint
Set oPoint1 = oSketch.SketchPoints.Add(oTG.CreatePoint2d(-10, 3.5), False)
Else
MsgBox ("pls select planar face")
End If
' create an Ifeaturedefinition object for a punch tool
Dim oSMFeatures As SheetMetalFeatures
Set oSMFeatures = oShMetDef.Features
Dim oiFeatureDef As iFeatureDefinition
Set oiFeatureDef = oSMFeatures.PunchToolFeatures.CreateiFeatureDefinition("J:\_Vorlagen\Inventor\Bibliothek\IDE\Punches\Langloch.ide")
'set the inpunt
' Dim oInput As iFeatureInput
' For Each oInput In oiFeatureDef.iFeatureInputs
'
' Dim oParamInput As iFeatureParameterInput
' Select Case oInput.Name
' Case "lg"
' Set oParamInput = oInput
' oParamInput.Expression = "1.6"
' Case "du"
' Set oParamInput = oInput
' oParamInput.Expression = "1.2"
' End Select
' Next
Dim oParamInput As iFeatureParameterInput
Set oParamInput = oiFeatureDef.iFeatureInputs.Item(1)
oParamInput.Expression = "16 mm"
Set oParamInput = oiFeatureDef.iFeatureInputs.Item(2)
oParamInput.Expression = "12 mm"
' Create the iFeature at 0 degree
Dim oPunchTool As PunchToolFeature
Set oPunchTool = oSMFeatures.PunchToolFeatures.Add(oPoint1, oiFeatureDef, 0, False) ' - here is problem i dont know what it is . Typen unverträglich (Fehler 13)
End Sub
Solved! Go to Solution.