Inventor API BUG SketchEntityD
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
Inventor 2022
API VB.NET Visual Studio
i found a Bug in API. Correct me, if im wrong.
I have a Sketch3D_01 with a Origin Spline, i Create New Sketch3D with a SketchEntity3D which include the Origin Spline from Sketch3D_01.
To Move the Curve i need to loose the Reference.
After this Moment, the new Spline Automaticlly change into a SketchControlPointSpline3D.
But for Inventor This is a SketchSpline3D !
The Problem is, that in Real this New Spline is a SketchControlPointSpline3D, but Inventor tell that this is SketchSpline3D
Next if you try to Take a FitPoint from the SketchSpline3D you got a Error, because there are not a FitPoints!
To move the Curve, is nessecery to do the Reference = False, because this make this issue. After this Momnet System see this Spline as SketchSpline3D and in real is SketchControlPointSpline3D.
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_10
Public Sub CommandFunctionfweButton_10()
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 Curve
Dim oCurve As SketchEntity3D = g_inventorApplication.CommandManager.Pick(SelectionFilterEnum.kSketch3DCurveFilter, "Pick a Curve")
'Create New Sketch3D for Entity
Dim oSketch3D_New As Sketch3D = oCompDef.Sketches3D.Add
'Create Entity
Dim oEntity3D As SketchEntity3D = oSketch3D_New.Include(oCurve)
'Check what is the Type
MsgBox("oEntity3D = " & oEntity3D.Type)
'Reference the Curve to have the possibility to move the Curve
oEntity3D.Reference = False
' After this Moment The Curve Automaticly Change in to SketchControlPointSpline3D although when you Check the Type,you got info, that this is SketchSpline3D !!
'Check what is the Type After Reference = False
MsgBox("oEntity3D = " & oEntity3D.Type)
'Create Spline as SketchSpline3D, if you try to Create this Spline as SketchControlPointSpline3D, you Got Error!
Dim oSpline As SketchSpline3D = oEntity3D
'Check what is the Type, now is the BUG, System tell you, that this is SketchSpline3D, but if you look how look the Spline, you will see this is SketchControlPointSpline3D
MsgBox("oSpline = " & oSpline.Type)
'i Try to Get a FitPoint, which should normal be in SketchSpline3D, but you got a Error, because Really this is a ControlSpline and ControlSpline has no FitPoints, has Only ControlPoints.
'But when you try to write ControlPoint, you got a Error, becuase SketchSpline3D has no ControlPoints !
Dim oPoint As SketchPoint3D = oSpline.FitPoint(1)
Dim oVector As Vector = oTG.CreateVector(0, 0, 10)
Dim oSplineFitPoints_01 As SketchPoint3D
For i = 1 To oSpline.FitPointCount
oSplineFitPoints_01 = oSpline.FitPoint(i)
oSplineFitPoints_01.MoveBy(oVector)
Next
End Sub
End Module
Thanks For Any Suggestion