Place a origin wp in the sketch (ipt)

Place a origin wp in the sketch (ipt)

Anonymous
Not applicable
247 Views
1 Reply
Message 1 of 2

Place a origin wp in the sketch (ipt)

Anonymous
Not applicable
I have this code to place a wp at the origin while in the sketch mode
It works fine with IV11 and seems to be not working with IV2008
Thx, CVA

On Error Resume Next

Dim oDoc As Document
Set oDoc = oInventorApp.ActiveDocument

If oInventorApp.ActiveDocument.DocumentType <> kPartDocumentObject And _
oInventorApp.ActiveDocument.DocumentType <> kAssemblyDocumentObject
Then
MsgBox ("Please use this button in Assembly or Part Sketch only")
Exit Sub
End If

Dim oSketch As PlanarSketch
If oDoc.SketchActive Then
'get active sketch
Set oSketch = oDoc.ActivatedObject
'project part origin
Dim oPoint As SketchEntity
Dim oWorkPoint As WorkPoint
Set oWorkPoint = oDoc.ComponentDefinition.WorkPoints.Item(1)
Set oPoint = oSketch.AddByProjectingEntity(oWorkPoint)
Else
MsgBox ("A sketck must be active")
End If

--
www.CVAengineering.com

IV11 Pro. sp2 and IV2008
Window XP Pro sp2
Pentium 3.2 Ghz, 3.0 GB of RAM
NVIDIA FX 3400 84.26
SpacePilot V 1.1.2
0 Likes
248 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
You need to make sure that the origin has not already been projected onto
the sketch. You can project the origin just once. So if the origin has
already been projected, the API call to project the origin will fail. I
believe this API worked the same in R11.

Sanjay-

"CVAengineering" wrote in message
news:5627703@discussion.autodesk.com...
I have this code to place a wp at the origin while in the sketch mode
It works fine with IV11 and seems to be not working with IV2008
Thx, CVA

On Error Resume Next

Dim oDoc As Document
Set oDoc = oInventorApp.ActiveDocument

If oInventorApp.ActiveDocument.DocumentType <> kPartDocumentObject And _
oInventorApp.ActiveDocument.DocumentType <> kAssemblyDocumentObject
Then
MsgBox ("Please use this button in Assembly or Part Sketch only")
Exit Sub
End If

Dim oSketch As PlanarSketch
If oDoc.SketchActive Then
'get active sketch
Set oSketch = oDoc.ActivatedObject
'project part origin
Dim oPoint As SketchEntity
Dim oWorkPoint As WorkPoint
Set oWorkPoint = oDoc.ComponentDefinition.WorkPoints.Item(1)
Set oPoint = oSketch.AddByProjectingEntity(oWorkPoint)
Else
MsgBox ("A sketck must be active")
End If

--
www.CVAengineering.com

IV11 Pro. sp2 and IV2008
Window XP Pro sp2
Pentium 3.2 Ghz, 3.0 GB of RAM
NVIDIA FX 3400 84.26
SpacePilot V 1.1.2
0 Likes