Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Importing sketch data to vba

Anonymous

Importing sketch data to vba

Anonymous
Not applicable

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

0 Likes
Reply
701 Views
8 Replies
Replies (8)

FINET_Laurent
Advisor
Advisor

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

WCrihfield
Mentor
Mentor

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

(Not an Autodesk Employee)

Anonymous
Not applicable

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

0 Likes

Anonymous
Not applicable
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)
0 Likes

Anonymous
Not applicable
I want to handle the distance of the each pair of points (any idea is okay)
0 Likes

FINET_Laurent
Advisor
Advisor

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

0 Likes

Anonymous
Not applicable
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
0 Likes

Anonymous
Not applicable

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

0 Likes