SKETCH SYMBOL WITH DATA FROM EXCEL TABLE

SKETCH SYMBOL WITH DATA FROM EXCEL TABLE

Victor.Tuguinay
Enthusiast Enthusiast
351 Views
1 Reply
Message 1 of 2

SKETCH SYMBOL WITH DATA FROM EXCEL TABLE

Victor.Tuguinay
Enthusiast
Enthusiast

I am wondering if it would be possible to create a sketch symbol using data from an excel file using ilogic.

 

My table looks like this.

 
 

1.png

 

The sketch symbol that I would like to create will be in this format.

 

2.png

 

Example output will look like this. The sketch symbol will be rotated by orientation (α). I am looking for something where I can specify the orientation like 10 deg and it will create the sketch symbol as shown below.

 

3.png

 

I am thinking user will be prompted to enter the angle (orientation). Then the program will retrieve the values for METRIC and IMPERIAL from the excel table. After that, it will insert the sketch symbol into the drawing showing the retrieved and prompted (α) values. The sketch symbol will also be rotated by the prompted angle (α).

0 Likes
352 Views
1 Reply
Reply (1)
Message 2 of 2

Curtis_Waguespack
Consultant
Consultant

Hi @Victor.Tuguinay,

 

Here is a quick version of this, you might need to adjust it a bit.

 

Currently, it expects:

  • a sketched symbol with 3 prompted entry fields
  • a spread sheet such as this:

Curtis_Waguespack_0-1650494050983.png

 

 

And as written it places a symbol at a static point (10,15) . 

 

I'm sure it's not exactly what you are after, but it should get you close.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

 

oPath = "C:\Temp\Server\"
oFile = oPath & "SketchSymbol_Info.xlsx" 'uses the above path to find the excel file
oSymbolName = "SymbolA"

Dim oList = New Double() {10, 20, 30 }
oInput = InputListBox("Prompt", oList, oList(0), "iLogic", "List")

GoExcel.FindRowStart = 2
iRow = GoExcel.FindRow(oFile, "Sheet1", "Orientation", "=", oInput)

oOrientation = GoExcel.CellValue(oFile, "Sheet1", "A" & iRow)
oMetric = GoExcel.CellValue(oFile, "Sheet1", "B" & iRow)
oImperial = GoExcel.CellValue(oFile, "Sheet1", "C" & iRow)

Dim oDoc As DrawingDocument = ThisDrawing.Document
Dim oSheet As Sheet = oDoc.ActiveSheet

Dim oSymDef As SketchedSymbolDefinition = oDoc.SketchedSymbolDefinitions.Item(oSymbolName)
Dim sPromptStrings(2) As String
sPromptStrings(0) = oOrientation &  Chr(176)
sPromptStrings(1) = oMetric
sPromptStrings(2) = "[" & oImperial & "]"

Dim oPosition As Point2d = ThisApplication.TransientGeometry.CreatePoint2d(10, 15)

oRotation = oOrientation * PI / 180

Dim oSymbol As SketchedSymbol
oSymbol = oSheet.SketchedSymbols.Add(oSymDef, oPosition, oRotation, 1, sPromptStrings)

 

 

EESignature

0 Likes