IMPORTING POINTS FROM EXCEL TO INVENTOR

IMPORTING POINTS FROM EXCEL TO INVENTOR

khushank.ks
Participant Participant
2,965 Views
4 Replies
Message 1 of 5

IMPORTING POINTS FROM EXCEL TO INVENTOR

khushank.ks
Participant
Participant

I want to import several points into inventor from excel.

The points in my excel spreadsheet are such that two consecutive rows contain the two end points of a line and the next two rows contain coordinates for another line.

Like:

1 2

3 4

2 3

5 6

Here, (1,2) and (3,4) are the end points of one line; (2,3) and (5,6) are the end points of the other line.

 

But when i import this into inventor, instead of making two separate lines, it connects all the points together.

How can it be done? 

0 Likes
Accepted solutions (1)
2,966 Views
4 Replies
Replies (4)
Message 2 of 5

johnsonshiue
Community Manager
Community Manager

Hi! I think this will have to be done via iLogic rule or VBA. There should be sample code for you to reference. Please take a look at the Solution#3 in below thread. You can add some code to create lines based on the points. Make sure you skip every two rows. to create a line.

 

https://knowledge.autodesk.com/support/inventor-products/learn-explore/caas/sfdcarticles/sfdcarticle...

 

Many thanks!

 



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer
0 Likes
Message 3 of 5

khushank.ks
Participant
Participant

This file does not load in the VBA editor.

It keeps on showing "No open projects".

0 Likes
Message 4 of 5

Xun.Zhang
Alumni
Alumni

@khushank.ks,

 

Here is an example for VBA to handle import point and make a spline though them all.

Hope it helps a little bit.

 

Sub CreateOneSpline()
    Dim oDoc As PartDocument
    Set oDoc = ThisApplication.ActiveDocument
    
    Dim oSk3d As Sketch3D
    Set oSk3d = oDoc.ComponentDefinition.Sketches3D(1)
    
    Dim oPoints As ObjectCollection
    Set oPoints = ThisApplication.TransientObjects.CreateObjectCollection
    Dim oPt As SketchPoint3D
    For Each oPt In oSk3d.SketchPoints3D
        oPoints.Add oPt
    Next
    
    Dim oNewSk3d As Sketch3D
    Set oNewSk3d = oDoc.ComponentDefinition.Sketches3D.Add
    
    Dim oSkSpline3d As SketchSpline3D
    Set oSkSpline3d = oNewSk3d.SketchSplines3D.Add(oPoints, kSmoothSplineFit)
End Sub 

Xun
Message 5 of 5

S_May
Mentor
Mentor
Accepted solution

Hi @khushank.ks,

 

You can practice with this...

 

2018-01-15 12_39_20-Autodesk Inventor 2016 - [3D-Oberflächenstruktur.ipt].png2018-01-15 13_16_58-Modelle über Excel S_May.rar - WinRAR (Nicht lizensierte Testversion).png