- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi everyone I'm having an issue with the set by point command on the workpoint object. It's throwing an error even though I have it set as adaptive and am inputting a point (I've also tried setting it with a new create point command in the transient geometry object and without).
Here is the code I'm running in VB.Net, I've attached the part file below.
Private Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click 'Parameter print out for debugging.
'Get part document information 'change to assembly
Dim part_doc As PartDocument ' get the active part document
part_doc = _invApp.ActiveDocument 'set part_doc as the active part document
Dim trans_geo As TransientGeometry 'get transient geometry from the application
trans_geo = _invApp.TransientGeometry 'set trans_geo as Transient Geometry object
Dim component_definition As ComponentDefinition 'Get the component definition from the part document.
component_definition = part_doc.ComponentDefinition
Dim active_part As PartComponentDefinition ' define the active component
active_part = part_doc.ComponentDefinition ' set the active component
Dim sketch As Sketch = active_part.Sketches.Item(1) 'get the active sketch
Dim point As Point = sketch.SketchPoints.Item(1).Geometry3d ' get the point.
Dim wp As WorkPoint = active_part.WorkPoints.Item("Work Point1") 'Get the work point
wp.Adaptive = True
wp.SetByPoint(point) 'set the workpoint to the point geometry.
'wp.SetByPoint(trans_geo.CreatePoint(1, 1, 1)) 'Alternate set point method also produces error.
End Sub
Solved! Go to Solution.