- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
Inventor 2022
API Visual Studio VB.NET
i try to Create a little bit Complex Sketch.
The Goal is to get Circulat Pattern of Lines in a SketchArc2d.
It works not bad, but only when i use simple Coordinates Points, for example 0,0 🙂
This is the code:
Imports System.Runtime.InteropServices
Imports Inventor
Imports Microsoft.Win32
Module CommandFunctionButton_09
Public Sub CommandFunctionfweButton_09()
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
Dim oCurve As Object = CType(g_inventorApplication.CommandManager.Pick(SelectionFilterEnum.kSketchCurveFilter, "Pick a Curve"), Object)
Dim oPlane09 As Object = CType(g_inventorApplication.CommandManager.Pick(SelectionFilterEnum.kWorkPlaneFilter, "Pick a Plane"), Object)
Dim oWorkSketch09 As PlanarSketch = oCompDef.Sketches.Add(oPlane09, False)
Dim oEntity09 As SketchEntity
oEntity09 = oWorkSketch09.AddByProjectingEntity(oCurve)
Dim oSketchLine09a As SketchLine
oSketchLine09a = oWorkSketch09.SketchLines.AddByTwoPoints(oEntity09.CenterSketchPoint, oEntity09.EndSketchPoint)
Dim oSketchLine09b As SketchLine
oSketchLine09b = oWorkSketch09.SketchLines.AddByTwoPoints(oEntity09.CenterSketchPoint, oEntity09.StartSketchPoint)
Dim oRotatePoint2 As Point2d
oRotatePoint2 = oTG.CreatePoint2d(10, 0)
Dim oAngleDim As TwoLineAngleDimConstraint
oAngleDim = oWorkSketch09.DimensionConstraints.AddTwoLineAngle(oSketchLine09a, oSketchLine09b, oRotatePoint2, True)
Dim oValueAngle As Double
oValueAngle = oAngleDim._DisplayValue
Dim oValue1 As Double
oValue1 = oValueAngle / 4
Dim oValue2 As Double
oValue2 = oValue1 * 2
Dim oValue3 As Double
oValue3 = oValue1 * 3
Dim oColection As ObjectCollection
oColection = oTO.CreateObjectCollection
Call oColection.Add(oSketchLine09b)
Dim oRotatePoint As Point2d
oRotatePoint = oTG.CreatePoint2d(0, 0)
Call oWorkSketch09.RotateSketchObjects(oColection, oRotatePoint, oValue1, True, False)
Call oWorkSketch09.RotateSketchObjects(oColection, oRotatePoint, oValue2, True, False)
Call oWorkSketch09.RotateSketchObjects(oColection, oRotatePoint, oValue3, True, False)
End Sub
End Module
The Question is:
a) How to Create Point2d from SketchPoint, for example from Start or EndPoint of Sketchline or Center of Arc?
For Example, when the CenterPoint of Arc is somewere in space, or to define the Point2d by Dimmension etc..
Not to using X and Y Coords.
b) How to Define the creating SketchLines via Feature "RotateSketchObject", so that i can later use this ?
as SketchLineR1, SketchLineR2, SketchLineR3 etc..
c) How to Define a existing already Arc2d in a Sketch via AddByProjectingEntity? for example to use the CenterPoint?
d) with API Sketch RotateSketchObject is not exactly the same, as we manually (native) use in Sketch CircularPattern, does CircularPattern working also in Sketch?
in RotateSketchObject we are not able to choose the count and etc...
How to make this with file Test_43, without using Coords X,Y to define Point2d.
Is it possible, to Create the Point2d using other methode?
Thanks for any Sugestion
Solved! Go to Solution.