Message 1 of 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
Inventor 2022
API VB.NET VisualStudio
i try to get access to the Created Curve with Method ProjectToSurface, but without success.
How to get the Curve?
i Dont want to Pick up this Curve with GUI.
This is my Code:
Imports System.Runtime.InteropServices
Imports Inventor
Imports Microsoft.Win32
Imports System.Collections.Generic
Imports System.Linq
Imports System.IO
Module CommandFunctionButton_08
Public Sub CommandFunctionfweButton_08()
Dim oPartDoc As PartDocument = g_inventorApplication.ActiveDocument
Dim oCompDef As PartComponentDefinition = oPartDoc.ComponentDefinition
Dim oTO As TransientObjects = g_inventorApplication.TransientObjects
Dim oTG As TransientGeometry = g_inventorApplication.TransientGeometry
'Pick the Surface
Dim oSurface_01 As Face = g_inventorApplication.CommandManager.Pick(SelectionFilterEnum.kPartFaceFilter, "Pick a Face")
'Pick the Origin Curve
Dim oGuideCurve As SketchEntity3D = g_inventorApplication.CommandManager.Pick(SelectionFilterEnum.kSketch3DCurveFilter, "Pick a Curve")
'Create Face Coll
Dim oFaceColl_forSurface As ObjectCollection
oFaceColl_forSurface = oTO.CreateObjectCollection
oFaceColl_forSurface.Add(oSurface_01)
'Create Curve Coll
Dim oCurveColl_forProjecting As ObjectCollection
oCurveColl_forProjecting = oTO.CreateObjectCollection
oCurveColl_forProjecting.Add(oGuideCurve)
'ProjectToSurfaceCurves
Dim oSketch3D_SurfaceCurve As Sketch3D = oCompDef.Sketches3D.Add
oSketch3D_SurfaceCurve.ProjectToSurfaceCurves.Add(oFaceColl_forSurface, oCurveColl_forProjecting, ProjectCurveToSurfaceTypeEnum.kProjectToClosestPointType)
'Create new Sketch 3D
Dim oSketch3D_Curve3D As Sketch3D = oCompDef.Sketches3D.Add
'Try to get Access to the Created Curve with ProjectToSurfaceCurves
Dim oCurve3D As SketchEntity3D
oCurve3D = oSketch3D_SurfaceCurve.Include(oSketch3D_SurfaceCurve.SketchEntities3D.Item(1))
End Sub
End Module
Second Code also not working:
Dim oCurveColl_forCurve As ObjectCollection
oCurveColl_forCurve = oTO.CreateObjectCollection
oCurveColl_forCurve.Add(oSketch3D_SurfaceCurve.ProjectToSurfaceCurves.Curves(1))
Dim oCurve3D As SketchEntity3D
oCurve3D = oCurveColl_forCurve.Item(1)
Other try:
oCurve3D.Curves(1) was Nothing
What is this for Curve type?
Thanks for any Suggestion
Solved! Go to Solution.