Hmmm, Okay I tried my idea and used the ToAngle method with the following criteria:
oBaseVector = 1,0,0 'Front view unitvector from left corner to right corner (original feature saved as an iFeature)
oVector 'unitvector based on selected Edge and Vertex.
When I use:
iFeatAngle = oBaseVector.AngleTo(oVector)
I get a number from 0 to PI. never over that. is that the return range? I was hoping to be able to get from 0 to 2(PI) so I could determine upto 270 degrees.
Also when using the oiFeatPlaneInput.SetPosition(oPoint, oVector.AsVector, iFeatAngle) method.
is the input angle in radians?
So far set position fails when I try to use it.
If I am using setposition should I not apply the rest of the required iFeature selected items?
Example:
'-------------------
Private Sub cmdOK_Click()
Dim oPrt As PartDocument
Dim oCompDef As PartComponentDefinition
Dim sVal As String
Dim sCut As String
Dim sFile As String
Dim sPath As String
Dim feat As PartFeature
Dim oiFeatDef As iFeatureDefinition
Dim oiFeatComps As iFeatureComponents
Dim oiFeatPlaneInput As iFeatureSketchPlaneInput
Dim oiFeatEntityInput1 As iFeatureEntityInput
Dim oiFeatEntityInput2 As iFeatureEntityInput
Dim oiFeatParamInput As iFeatureParameterInput
Dim oiFeat As iFeatureComponent
Dim oGeo As TransientGeometry
Dim oPoint As Inventor.Point
Dim oVector As Inventor.UnitVector
Dim oBaseVector As Inventor.UnitVector
Dim iFeatAngle As Double
Dim Pt(2) As Double
Dim SPts(2) As Double
Dim EPts(2) As Double
Dim oSPoint As Point
Dim oEPoint As Point
Dim oVPoint As Point
Dim oCmd As Inventor.CommandManager
Dim oCtrlDef As ControlDefinition
Dim s As String
Dim i As Integer
cmdClearAll.SetFocus
Set oPrt = ThisApplication.ActiveDocument
Set oCompDef = oPrt.ComponentDefinition
Set oiFeatComps = oCompDef.ReferenceComponents.iFeatureComponents
Set oGeo = ThisApplication.TransientGeometry
'------- Create iFeature ------
sFile = "Bend_LT_Up.ide"
sPath = "C:\Program Files\Autodesk\Inventor 10\Catalog\" & sFile
Set oiFeatDef = oCompDef.ReferenceComponents.iFeatureComponents.CreateDefinition(sPath)
Set oiFeatPlaneInput = oiFeatDef.iFeatureInputs.item(1)
oiFeatPlaneInput.PlaneInput = oFace
Call oVertex.GetPoint(Pt)
Set oPoint = oGeo.CreatePoint(Pt(0), Pt(1), Pt(2))
Call oEdge.StartVertex.GetPoint(SPts)
Call oEdge.StopVertex.GetPoint(EPts)
Set oSPoint = oGeo.CreatePoint(SPts(0), SPts(1), SPts(2))
Set oEPoint = oGeo.CreatePoint(EPts(0), EPts(1), EPts(2))
If oPoint.IsEqualTo(oSPoint) Then Set oVPoint = oEPoint
If oPoint.IsEqualTo(oEPoint) Then Set oVPoint = oSPoint
Set oVector = oPoint.VectorTo(oVPoint).AsUnitVector
'Predetermined from original feature
'---
Set oBaseVector = oGeo.CreateUnitVector(1, 0, 0)
'---
iFeatAngle = oBaseVector.AngleTo(oVector)
MsgBox iFeatAngle
Call oiFeatPlaneInput.SetPosition(oPoint, oVector.AsVector, iFeatAngle)
'----
Set oiFeatEntityInput1 = oiFeatDef.iFeatureInputs.item(2)
oiFeatEntityInput1.Entity = oVertex
Set oiFeatEntityInput2 = oiFeatDef.iFeatureInputs.item(3)
oiFeatEntityInput2.Entity = oEdge
Set oiFeatParamInput = oiFeatDef.iFeatureInputs.item(4)
oiFeatParamInput.Expression = ".125 in"
'On Error Resume Next
Set oiFeat = oiFeatComps.Add(oiFeatDef)
'------- End Create iFeature ------
Set oCmd = ThisApplication.CommandManager
Set oCtrlDef = oCmd.ControlDefinitions("PartiFeatureEditCtxCmd")
Call oPrt.SelectSet.Select(oCompDef.Features (oiFeat.Name))
oCtrlDef.Execute
Set oVertex = Nothing
Set oFace = Nothing
lblVertex.BackColor = UsedColor
lblEdge.BackColor = UsedColor
lblFace.BackColor = UsedColor
ThisApplication.ActiveDocument.Activate
End Sub
'-------------------
Puzzled but optimystic,
Message was edited by: TomGroff