Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

programming solid edge visual basic 6 1

Status
Not open for further replies.

666vito

Industrial
Jul 23, 2007
21
0
0
IT
Hi
I make a programm that get 2d geometry from a sketch in solid edge. With this code I get start end point of a line 2d: For Each objLine2d In objProf.Lines2d
Call objLine2d.GetEndPoint(dx, dy)
Call objLine2d.GetStartPoint(dx, dy)
Next objLine2d (by donyoung engtips)
Now I get information about circle ( center point and radius) and arsc2D in a solid edge help I found some information but some code don't work. I use
For Each objCircle2d In objprof.Circles2d
i = i + 1
Next objCircle2d
To count circles and to get center and radius
call objcircle2d.getcenterpoint( x,y)
call objcircle2d.getradius (g)
but it don't work. In teh same way I can count the arc2d but can't get center point ant the start end point.
Can you help me.
Thanks
 
Replies continue below

Recommended for you

Hi,

I've made one protrusion containing two seperate items
1 cylinder and one quarter cylinder just to have 1 circle
and 1 arc. One extra sketch with 1 circle. This one did work:

Dim objProf As Profile
Dim objCircle2d As Circle2d
Dim objArc2d As Arc2d
Dim xo As Double
Dim yo As Double
Dim zo As Double
Set mApp = GetObject(, "SolidEdge.Application")
Set mPart = mApp.ActiveDocument
'
' for circles, arcs defined as sketches:
Call mPart.Sketches.Item(1).Profiles.Item(1).Circles2d.Item(1).GetCenterPoint(xo, yo)
MsgBox "X=" & xo & "Y=" & yo
'
' for circles, arcs defined as profiles:
Set objProf = mPart.ProfileSets.Item(1).Profiles.Item(1)
For Each objCircle2d In objProf.Circles2d
Call objCircle2d.GetCenterPoint(xo, yo)
zo = objCircle2d.Radius
MsgBox "X=" & xo & " Y=" & yo & " radius=" & zo
Next objCircle2d
'
Set objProf = mPart.ProfileSets.Item(1).Profiles.Item(2)
For Each objArc2d In objProf.Arcs2d
Call objArc2d.GetCenterPoint(xo, yo)
zo = objArc2d.Radius
MsgBox "Center " & "X=" & xo & " Y=" & yo & " radius=" & zo
Call objArc2d.GetStartPoint(xo, yo)
MsgBox "Start " & "X=" & xo & " Y=" & yo
Call objArc2d.GetEndPoint(xo, yo)
MsgBox "End " & "X=" & xo & " Y=" & yo
Next objArc2d

Note: all values returned are on Meters(!)

dy
 
Hi

usually one has mor than one circle in more than one
profile/sketch. So you have to loop over all ProfileSets
all Profiles and all Circles2d:

'
' for circles, arcs defined as profiles:
Dim objProSet As ProfileSet
Dim objProf As Profile
Dim objCircle2d As Circle2d
'
Set mApp = GetObject(, "SolidEdge.Application")
Set mPart = mApp.ActiveDocument
'
' loop over structure
For Each objProSet In mPart.ProfileSets
For Each objProf In objProSet.Profiles
For Each objCircle2d In objProf.Circles2d
Call objCircle2d.GetCenterPoint(xo, yo)
zo = objCircle2d.Radius
MsgBox "X=" & xo & " Y=" & yo & " radius=" & zo
Next objCircle2d
Next objProf
Next objProSet

dy
 
Thanks donyoung
But my sketch is on an assembly file. Your code can work also in this kind of file?
This line can create some problem?
For Each objProSet In mPart.ProfileSets
BYe
 
Hi,

would you please so kind to tell the audience (in the future):

- on which file type your are working
- in which environment of that file you are working
i.e. whether it be sketch or a profile or whatever

The above coding does not work in an assembly this one
should do:


Dim objCircle2d As Circle2d
Dim objLayout As Layout
Set mApp = GetObject(, "SolidEdge.Application")
Set mAsm = mApp.ActiveDocument
For Each objLayout In mAsm.Layouts
For Each objCircle2d In objLayout.Profile.Circles2d
'
' your coding here
'
Next objCircle2d
Next objLayout

I think it will considerably ease your task when you familiarize
yourself with the SE-API and its objects and methods

dy
 
Status
Not open for further replies.
Back
Top