Hi,
I'm using VB Express 2010 and Inventor 2013. I want enable/disable construction mode in sketch plane inner API program... How?...
Regards,
Mucip:)
To set the Construction to a sketch entity you can use SketchEntity.Construction property, a sample VB code snippet can be like below:
'say you have the oSketch assigned with a planar sketch Dim oSketchLine As SketchLine oSketchLine = oSketch.SketchLines.Item(1) oSketchLine.Construction = True
Hope this helps.
Dear Yuhanzhang,
Thanks a lot.
My code like below,
rectangleLines = sk.SketchLines.AddAsTwoPointRectangle( _
tg.CreatePoint2d(CerceveIlkX, CerceveIlkY), _
tg.CreatePoint2d(CerceveIlkX + CerceveXMesafe, CerceveIlkY + CerceveYMesafe))
And I added blow code to make rectangule in construction mode,
rectangleLines.Item(1).Construction = True
rectangleLines.Item(2).Construction = True
rectangleLines.Item(3).Construction = True
rectangleLines.Item(4).Construction = True
But in any case I wanted to enable construction mode like I pressed contruction button on format section in ribbon bar... This will be much easier if posssible...
Regards,
Mucip:)
You can call the command definition to toggle the Construction mode, sample VBA code is like below:
Sub ToggleSketchConstruction() ThisApplication.CommandManager.ControlDefinitions.Item("SketchConstructionCmd").Execute End Sub
Hope this helps.
Dear YuhanZhang,
That's what I need exactly but I couldn't get any solution with the below my code in VB-2010 Express:
Form1.inv_App.CommandManager.ControlDefinitions.Item("SketchConstructionCmd").Execute()
Regards,
Mucip:)
Did it raise any error? And can you make sure you call this method when a planar sketch is in edit mode?
Hi,
Your code is working actually. When I run your code seperately in Button_click procedure it works and contruction button become active. But when I run your code between my code like below than code is not working. With below code it's expected that first line and arc normal and second line and arc is in construction mode. But after the code all line and arcs are normal (not construction!) and after the below code construction button becomes active... Very interesting... I think we need to some update or delay command after "construction mode activation" code part?!...
Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
Dim sk As PlanarSketch
sk = Form1.inv_App.ActiveEditObject
Dim tg As TransientGeometry
tg = Form1.inv_App.TransientGeometry
Dim line1 As SketchLine
Dim arc1 As SketchArc
Dim line2 As SketchLine
Dim arc2 As SketchArc
line1 = sk.SketchLines.AddByTwoPoints(tg.CreatePoint2d(0, 0), tg.CreatePoint2d(10, 0))
arc1 = sk.SketchArcs.AddByCenterStartEndPoint(tg.CreatePoint2d(10, 2), line1.EndSketchPoint, tg.CreatePoint2d(10, 4))
' Bu kısım yardımcı çizgi modunu açmak için...
Form1.inv_App.CommandManager.ControlDefinitions.Item("SketchConstructionCmd").Execute()
line2 = sk.SketchLines.AddByTwoPoints(arc1.EndSketchPoint, tg.CreatePoint2d(0, 4))
arc2 = sk.SketchArcs.AddByCenterStartEndPoint(tg.CreatePoint2d(0, 2), line2.EndSketchPoint, line1.StartSketchPoint)
End Sub
Regards,
Mucip:)
I tried you code here and see the same problem. This should be an API bug that even the Construction mode is on the sketch entities created by API are still normal. Seems now the workaround is to set the Construction property for each sketch entity.