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
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??
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
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
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
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...
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