×
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

Information of elements in VB language

Information of elements in VB language

Information of elements in VB language

(OP)
Hi,

Sorry to post a new thread, but I have a new problem :
I want to get back the length of a segment on a part, like with "Information of element" with Solid Edge.
Can anyone tell me if it's possible, and how ?
Thank you,
Arno

RE: Information of elements in VB language

(OP)
I've found a fonction : GetLengthAtParam and I've tried :

Dim ObjDocPart As SolidEdgePart.PartDocument
Dim depart As Double
Dim arrivee As Double
Dim longueur As Double

Call objApp.Documents.Open("C:\toto.par")
Set ObjDocPart = objApp.ActiveDocument
depart = -50
arrivee = 50
Call ObjDocPart.Model(1).Body.Edges(1).Item(1).GetLengthAtParam(FromParam:=depart, ToParam:=arrivee, Length:=longueur)

But it doesn't work... Can anyone help me please ?

RE: Information of elements in VB language

Can you help me?? i have a similar problem, i have a sketch
on a assembly file and a programm in visualb6. From visualb programm i'd like to obtein the sketch's point position... I think that is possible but i don't know how??
Can you tell me something??

RE: Information of elements in VB language

(OP)
Sorry but I've not found the solution at this problem. Have you tested my example ?
In the help of SE, there is an exemple for VB6, I can't use it because I'm using VBA, but You can try :

Private Sub Form_Load()
Dim objApp As SolidEdgeFramework.Application
Dim objDoc As SolidEdgePart.PartDocument
Dim objBody As SolidEdgeGeometry.Body
Dim objEdge As SolidEdgeGeometry.Edge
Dim dblFromParam As Double
Dim dblToParam As Double
Dim dblLength As Double
' Report errors
Const PI = 3.14159265358979
' Create/get the application with specific settings
On Error Resume Next
Set ObjApp = GetObject(, "SolidEdge.Application")
If Err Then
Err.clear
Set ObjApp = CreateObject("SolidEdge.Application")
Set ObjDoc = objApp.Documents.Add("SolidEdge.PartDocument")
objApp.Visible = True
Else
Set ObjDoc = objApp.ActiveDocument
End If
' creating the base feature
If CreateModel(objDoc) <> "" Then
MsgBox "Error creating the model"
Exit Sub
End If
' getting the body object of the model
Set objBody = objDoc.Models(1).Body
'getting an edge from the collection of edges of the body
Set objEdge = objBody.Edges(EdgeType:=igQueryAll).Item(2)
' getting the length between two given points on an edge
dblFromParam = 0
dblToParam = PI / 2
Call objEdge.GetLengthAtParam(FromParam:=dblFromParam, ToParam:=dblToParam, Length:=dblLength)
' USER DISPLAY
' Release objects
Set objApp = Nothing
Set objDoc = Nothing
Set objBody = Nothing
Set objEdge = Nothing
End Sub

Arno

RE: Information of elements in VB language

Arno,

you may find and example to get the length information here:

Length Info

I've hacked it in a hurry from one of my programs. Just
unzip and compile it. Have an SE file other than draft open
and start the program

HTH

dy

RE: Information of elements in VB language

Hi arno and thanks
I tested yours example, it is very interesting for my problem but don't work end i don't know why..
Now i try to use the two new examble that you propose...
I use visual basic 6 and solid edge v16 and in this case my and yours problem it will be very simply but I can't find a solution..
Thanks if I can give you materials and iformation

RE: Information of elements in VB language

(OP)
Tks very much donyoung, I will try it...
And 666vito it true than it should be very simple, but I think that if the solution of Donyoung is not adapted for my problem, I will abort it because I've not enough time to resolve this problem.
If you solve the problem, tell me how you've done it please,
Bye

RE: Information of elements in VB language

(OP)
It's working !!
Thank you very much donyoung, I've looked at your program and I've adapted it at my problem.
In fact I didn't use the function GetParamExtents to have dmin and dmax to use them in the function GetLengthAtParam. But now it's perfect !

666vito, if it can help you, this is my program to have the length of an edge in a part :

    Dim dMin As Double
    Dim dMAx As Double
    Dim dLength As Double
    Call ObjDocPart.Models.Item(1).Body.Edges(EdgeType:=1).Item(i).GetParamExtents(dMin, dMAx)
    Call ObjDocPart.Models.Item(1).Body.Edges(EdgeType:=1).Item(i).GetLengthAtParam(dMin, dMAx, dLength)

You have to know what is the number of the edge than you recuperate. My part was complicated, so I've used :

    Dim i As Variant
    For i = 0 To ObjDocPart.Models.Item(1).Body.Edges(EdgeType:=1).Count
        Call ObjDocPart.Models.Item(1).Body.Edges(EdgeType:=1).Item(i).GetParamExtents(dMin, dMAx)
        Call ObjDocPart.Models.Item(1).Body.Edges(EdgeType:=1).Item(i).GetLengthAtParam(dMin, dMAx, dLength)
    P = dLength * 1000
    Range("K" & i + 1) = P     'Pour le 1er périmètre
    Range("N" & i + 1) = P     'Pour le 2e périmètre
    Next i

With that I can identifiy all length of edges and after use the two first function just on edges I want...

Tks,
Bye

RE: Information of elements in VB language

hi arno4012
i'm very happy for you, donyoung's program is very interesting , it's working, but it isn't adapted to resolve my problem. I will use your program trying it on a sketch.
But i have another problem yet, the point cordinate....
good job...........
666vito

RE: Information of elements in VB language

(OP)
ok tks and good luke,
Arno

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