Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Macro to measure line and point using "Any geometry, infinite" selection mode

Status
Not open for further replies.

vikt

Mechanical
Mar 13, 2013
52
US
Hi guys,
I am trying to measure distance between a line and a point using below code.

ptref = Partdocument.Part.CreateReferenceFromObject(pt1) 'creating reference from point
refline = Partdocument.Part.CreateReferenceFromObject(line1) 'creating reference from line

'Get measure
TheMeasurable = TheSPAWorkbench.GetMeasurable(refline)
dist1 = TheMeasurable.GetMinimumDistance(ptref)

since line and point are at different plane, i am not getting the required output.
I want to to measure using "Any geometry,infinite option".
Please suggest how i can incorporate that.

regards,
vikt
 
Replies continue below

Recommended for you

hello vikt,
why don't you recreate the line, and make it infinite?
use it then to measure your distance.
SetLengthType is the method you want to use:
Sub SetLengthType( long iType)

Sets the length type Default is 0.
Parameters:
iType
The length type = 0 : length - the line is limited by its extremities = 1 : infinite - the line is infinite = 2 : infinite start point - the line is infinite on the side of the start point = 3 : infinite end point - the line is infinite on the side of the end point

you call it by:
hybridShapeLinePtPt2.SetLengthType 1

regards,
LWolf
 
Thanks lWolf.
Actually, it's an already existing, isolated line in a geo set which i have to use for measurement.
but yes, i can definitely try what you suggested.

regards,
vikt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top