×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

programming solid edge visual basic 6

programming solid edge visual basic 6

programming solid edge visual basic 6

(OP)
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

RE: programming solid edge visual basic 6

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

RE: programming solid edge visual basic 6

(OP)
Thanks
The code is ok, but I have some problem when I have 2 or 3 circle

RE: programming solid edge visual basic 6

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

RE: programming solid edge visual basic 6

(OP)
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

RE: programming solid edge visual basic 6

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources