& Construction

Integrated BIM tools, including Revit, AutoCAD, and Civil 3D
& Manufacturing

Professional CAD/CAM tools built on Inventor and AutoCAD
Integrated BIM tools, including Revit, AutoCAD, and Civil 3D
Professional CAD/CAM tools built on Inventor and AutoCAD
Hello together,
I try to convert this tool:
But I have an error in my code:
Private Sub PreviewPoints() ' Generierung der Liste der aktuellen Punkte ' Erstellen der Punkte und Hinzufügen zur Punkteliste Dim oSelectSet As SelectSet oSelectSet = m_inventorApplication.ActiveDocument.SelectSet oSelectSet.Clear() Dim oTransGeom As TransientGeometry Dim nPointPreview As Object 'Dim nPoint As Object = Nothing oTransGeom = m_inventorApplication.TransientGeometry Dim oPreviewPoints As ObjectCollection oPreviewPoints = m_inventorApplication.TransientObjects.CreateObjectCollection Dim oPoints(nPoint) As Point2d For i = 1 To nPoint ' Generieren des aktuellen Punkts oPoints(i) = oTransGeom.CreatePoint2d(oPointCoordX(i), oPointCoordY(i)) '==>>> Error ' Aufnahme des Punkts in die Liste oPreviewPoints.Add(oPoints(i)) Next i 'oSelect.Select oPreviewPoints ' Hinzufügen der Punkte zur aktuellen Ebene Dim oSketch As PlanarSketch oSketch = m_inventorApplication.ActiveEditObject For i = 1 To nPoint ' Generieren des aktuellen Punkts als Mittelpunkt (mit Markierung) oSketch.SketchPoints.Add(oPoints(i), True) Next i ' Warten auf die Bestätigung MsgBox("Vorschau beenden") ' Löschen der aktuellen Punkte nPointPreview = oSketch.SketchPoints.Count For i = nPointPreview To nPointPreview - nPoint + 1 Step -1 ' MsgBox "Typ: " & TypeName(obj) ' Selektieren des aktuellen Punkts oSelectSet.Select(oSketch.SketchPoints(i)) Next oSelectSet.Delete() End Sub
Thank you
Georg
There is a lot more then just convert to VB.Net.
You can find a template from SDK.
Take a look at API help on addin development.
Hello @Frederick_Law ,
I have an add-in already. This tool would be nice to have it in my add-in 🙂
Thanks
Georg
I think you have VBA macro?
And try to convert it to an "app" or addin?
I read you other post.
In the other post is a VBA macro.
https://forums.autodesk.com/autodesk/attachments/autodesk/78/744546/4/DialogPolylineToSpline.zip
I tried to convert it to VB.Net for my existing add-in.
Attached is a standalone version.
Can you please explain the requirement in detail with non confidential VBA code?
what is nPoint variable (Declared, but not defined properly)?
Thanks and regards,
Hello @chandra.shekar.g ,
I tried to convert the VBA program from my initial post to VB.Net.
Thank you
Georg
Hi there,
I'm the author of the VBA-Tool. I've put the whole code into a VBA-UserForm. And to keep it simple I am using some "global" declarations in the beginning of the code.
So the prefix 'n' is for number of, 'm' for maximum number of, 'o' for object, 'i' for indices. Maybe this helps reading the code, because I did all the comments in German 😉
Regards
Can you please provide reproducible steps to investigate?
Thanks and regards,
I tried to convert it to VB.Net. There is an error in the marked line:
Private Sub PreviewPoints() ' Generierung der Liste der aktuellen Punkte ' Erstellen der Punkte und Hinzufügen zur Punkteliste Dim oSelectSet As SelectSet oSelectSet = m_inventorApplication.ActiveDocument.SelectSet oSelectSet.Clear() Dim oTransGeom As TransientGeometry Dim nPointPreview As Object 'Dim nPoint As Object = Nothing oTransGeom = m_inventorApplication.TransientGeometry Dim oPreviewPoints As ObjectCollection oPreviewPoints = m_inventorApplication.TransientObjects.CreateObjectCollection Dim oPoints(nPoint) As Point2d For i = 1 To nPoint ' Generieren des aktuellen Punkts oPoints(i) = oTransGeom.CreatePoint2d(oPointCoordX(i), oPointCoordY(i)) '==>>> Error !!!! ' Aufnahme des Punkts in die Liste oPreviewPoints.Add(oPoints(i)) Next i 'oSelect.Select oPreviewPoints ' Hinzufügen der Punkte zur aktuellen Ebene Dim oSketch As PlanarSketch oSketch = m_inventorApplication.ActiveEditObject For i = 1 To nPoint ' Generieren des aktuellen Punkts als Mittelpunkt (mit Markierung) oSketch.SketchPoints.Add(oPoints(i), True) Next i ' Warten auf die Bestätigung MsgBox("Vorschau beenden") ' Löschen der aktuellen Punkte nPointPreview = oSketch.SketchPoints.Count For i = nPointPreview To nPointPreview - nPoint + 1 Step -1 ' MsgBox "Typ: " & TypeName(obj) ' Selektieren des aktuellen Punkts oSelectSet.Select(oSketch.SketchPoints(i)) Next oSelectSet.Delete() End Sub
DialogPolylineToSpline.zip contains DialogPolylineToSpline.frm and DialogPolylineToSpline.frx files which may not used to debug the code. Can you please provide non confidential solution to debug the code?
Thanks and regards,
Can you please provide non confidential sample model data and steps to reproduce the issue?
Thanks and regards,
Gave a try to reproduce the error. But inventor crashed in between while testing it. Can you please give reproducible steps to test the behavior?
Thanks and regards,
Hello @chandra.shekar.g ,
the ipt is working with the VBA code. But it's not working with the VB.Net code. I couldn't find the answer for the crash.
Thank you Georg
Hoping that below change may be helpful.
Private Sub PreviewPoints() ' Generierung der Liste der aktuellen Punkte ' Erstellen der Punkte und Hinzufügen zur Punkteliste Dim oSelectSet As SelectSet oSelectSet = m_inventorApplication.ActiveDocument.SelectSet oSelectSet.Clear() Dim oTransGeom As TransientGeometry Dim nPointPreview As Object 'Dim nPoint As Object = Nothing oTransGeom = m_inventorApplication.TransientGeometry Dim oPreviewPoints As ObjectCollection oPreviewPoints = m_inventorApplication.TransientObjects.CreateObjectCollection Dim oPoints(nPoint) As Point2d For i = 0 To nPoint -1 ' Generieren des aktuellen Punkts oPoints(i) = oTransGeom.CreatePoint2d(oPointCoordX(i), oPointCoordY(i)) '==>>> Error !!!! ' Aufnahme des Punkts in die Liste oPreviewPoints.Add(oPoints(i)) Next i 'oSelect.Select oPreviewPoints ' Hinzufügen der Punkte zur aktuellen Ebene Dim oSketch As PlanarSketch oSketch = m_inventorApplication.ActiveEditObject For i = 1 To nPoint ' Generieren des aktuellen Punkts als Mittelpunkt (mit Markierung) oSketch.SketchPoints.Add(oPoints(i), True) Next i ' Warten auf die Bestätigung MsgBox("Vorschau beenden") ' Löschen der aktuellen Punkte nPointPreview = oSketch.SketchPoints.Count For i = nPointPreview To nPointPreview - nPoint + 1 Step -1 ' MsgBox "Typ: " & TypeName(obj) ' Selektieren des aktuellen Punkts oSelectSet.Select(oSketch.SketchPoints(i)) Next oSelectSet.Delete() End Sub
Thanks and regards,
How to buy
Privacy | Do not sell or share my personal information | Cookie preferences | Report noncompliance | Terms of use | Legal | © 2025 Autodesk Inc. All rights reserved
Type a product name