Message 1 of 5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am getting this result when using .AddWithLeaders with a view that has been scaled (1/2"=1"). It seems that the geometry can't communication between the 2; but if I try modifying the geometry intent points by a scale factor, it always throws an error.
The basics of the program is:
Dim oDLine As DrawingCurveSegment
Dim oDwgDoc As DrawingDocument = ThisApplication.ActiveDocument
Dim oView As DrawingView
Dim oSketch As DrawingSketch
Dim oLine As SketchLine
Dim oSecLine As SketchLine
Dim angle As Double
Dim tailangle As Double
oDLine = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingCurveSegmentFilter, "Select the LINE")
oSP = oDLine.StartPoint
oEP = oDLine.EndPoint
Dim oV1 As Vector2d
Dim oV2 As Vector2d
If oEP.Y > oSP.Y
oV1 = ThisApplication.TransientGeometry.CreateVector2d(oEP.X - oSP.X, oEP.Y - oSP.Y)
oV2 = ThisApplication.TransientGeometry.CreateVector2d(1, 0)
Else
oV1 = ThisApplication.TransientGeometry.CreateVector2d(oSP.X - oEP.X, oSP.Y - oEP.Y)
oV2 = ThisApplication.TransientGeometry.CreateVector2d(1, 0)
End If
angle = oV2.AngleTo(oV1)
For Each oView In oDwgDoc.ActiveSheet.DrawingViews
For Each oSketch In oView.Sketches
For Each oLine In oSketch.SketchLines
If Math.Abs(Math.Round(oView.Scale*(oLine.StartSketchPoint.Geometry.X - oLine.EndSketchPoint.Geometry.X),3)) = Math.Abs(Math.Round((oSP.X - oEP.X),3)) And _
Math.Abs(Math.Round(oView.Scale*(oLine.StartSketchPoint.Geometry.Y - oLine.EndSketchPoint.Geometry.Y),3)) = Math.Abs(Math.Round((oSP.Y - oEP.Y),3))
oSecLine = oLine
End If
Next
Next
Next
Dim oTG As TransientGeometry
Dim oGeometryIntent1 As GeometryIntent
Dim oLeaderPoints1 As ObjectCollection
Dim oGeometryIntent2 As GeometryIntent
Dim oLeaderPoints2 As ObjectCollection
oTG = ThisApplication.TransientGeometry
oLeaderPoints1 = ThisApplication.TransientObjects.CreateObjectCollection
oLeaderPoints1.Add(oSP)
oLeaderPoints1.Add(oSP)
oGeometryIntent1 = oDwgDoc.ActiveSheet.CreateGeometryIntent(oSecLine, oSecLine.StartSketchPoint.Geometry)
oLeaderPoints1.Add(oGeometryIntent1)
oLeaderPoints2 = ThisApplication.TransientObjects.CreateObjectCollection
oLeaderPoints2.Add(oEP)
oLeaderPoints2.Add(oEP)
oGeometryIntent2 = oDwgDoc.ActiveSheet.CreateGeometryIntent(oSecLine, oSecLine.EndSketchPoint.Geometry)
oLeaderPoints2.Add(oGeometryIntent2)Any help is greatly appreciated! Thanks.
--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.
Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization

iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread
Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects
Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help
Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization
iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread
Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects
Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help
Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
Solved! Go to Solution.
