Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Importing sketch data to vba

8 REPLIES 8
Reply
Message 1 of 9
elei0947
299 Views, 8 Replies

Importing sketch data to vba

I want to make code to automize the design. I want to import sketch data into VBA (or VB.NET) . Can somebody help me which library does it help this. I want to know the information of lines, length, position etc

8 REPLIES 8
Message 2 of 9
FINET_Laurent
in reply to: elei0947

This?

 

Dim oDoc As Document
oDoc = ThisApplication.ActiveDocument

Dim oPartCompDef As PartComponentDefinition
oPartCompDef = oDoc.ComponentDefinition

Dim oSketch As Sketch

	oSketch = oPartCompDef.Sketches.Item(1)

Regards,

 

FINET L .

If this post solved your question, please kindly mark it as "Solution"

If this post helped out in any way to solve your question, please drop a "Like"

@LinkedIn     @JohnCockerill

Message 3 of 9
WCrihfield
in reply to: elei0947

Can you please explain what you want in more detail?  It is a little difficult to understand.  It sounds like you are trying to automate something, and to do so you want to gather information about a sketch and/or all the individual entities within a sketch.  If so, why?  What are you looking for?  What are you planning on doing with this data?  What kind of end result are you trying to achieve?

Wesley Crihfield

EESignature

Message 4 of 9
elei0947
in reply to: FINET_Laurent

I used this code to import point coordinates but I think I need to read and write to the point by using code.(sketchpoints code can only read ) is there any possible way to interact directly with the inventor and VBA?

 

Private Sub CommandButton1_Click()


Dim opartDoc As PartDocument
Set opartDoc = ThisApplication.ActiveDocument
Dim opartcompdef As PartComponentDefinition
Set opartcompdef = opartDoc.ComponentDefinition


Dim osketch As Sketch
Set osketch = opartcompdef.Sketches.Item(1)


Dim osketchPoint As SketchPoint
Dim coll_x As New ArrayList
Dim coll_y As New ArrayList




For Each osketchPoint In osketch.SketchPoints

coll_x.Add osketchPoint.Geometry.x
coll_y.Add osketchPoint.Geometry.Y

Next


End Sub

Message 5 of 9
elei0947
in reply to: WCrihfield

I`m planning to make a standalone application or VBA module to help make a light beam guide board. This is the board that can mount mirrors, filters, lens etc.
so the first thing we need to do is draw a beam guide line and want to extract the information(beam guideline looks like branches, have right angle) of beam guide node information to the standalone application or VBA because we want to give a beam guide some constraint. (ex, lens equation, gaussian eq, beam size) so I want to know how can I interact with code? and inventor. (Sorry for the poor explanation. It`s hard to explain because this is my first time developing some programs, also VBA is my first time)
Message 6 of 9
elei0947
in reply to: elei0947

I want to handle the distance of the each pair of points (any idea is okay)
Message 7 of 9
FINET_Laurent
in reply to: elei0947

Add a dimention with an user parameter ? 

I'm not sure why you need a stand alone application for this.

 

Regards,


FINET L.

If this post solved your question, please kindly mark it as "Solution"

If this post helped out in any way to solve your question, please drop a "Like"

@LinkedIn     @JohnCockerill

Message 8 of 9
elei0947
in reply to: FINET_Laurent

I don`t exactly figure out the way to control the parameter. Is there better way to handle the parameter more easier?

I`m planning to make a standalone application or VBA module to help make a light beam guide board. This is the board that can mount mirrors, filters, lens etc.
so the first thing we need to do is draw a beam guide line and want to extract the information(beam guideline looks like branches, have right angle) of beam guide node information to the standalone application or VBA because we want to give a beam guide some constraint. (ex, lens equation, gaussian eq, beam size) so I want to know how can I interact with code? and inventor. (Sorry for the poor explanation. It`s hard to explain because this is my first time developing some programs, also VBA is my first time)
I just want to import point information and want to handle it by code or some way

Regards

Sung Joo Lim
Message 9 of 9
elei0947
in reply to: elei0947

elei0947_0-1624606012655.png

I think i need to explain more about it. The above image is beam guideline and node. I wanted to import sketch data into the object( maybe it will be points of the node) and want to control the distance between points by using code.  Is there any good way to handle it?(  I wanted to make oop program)

 

Regard

SJ Lim

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report