Jump to content

vlax-curve-getStartParam .... vlax-curve-getStartPoint


Lee Mac

Recommended Posts

Hi Guys,

 

Hope everyone is enjoying their Sunday.

 

Was just trying to learn some VL and came across the "start point" and "start param" fuctions.

 

Was just wondering - what is the difference between a start point and start parameter?

 

The reason I ask is this:

 

I was trying to get the length of a curve and didn't know whether to do this:

 

[color=Green][b](setq ent (car (entsel))
     dis (vlax-curve-getDistAtParam ent (vlax-curve-getEndParam ent)))[/b][/color]

Or this:

 

[b][color=Green](setq ent (car (entsel))
     dis (vlax-curve-getDistAtPoint ent (vlax-curve-getEndPoint ent)))[/color][/b]

Also, do the entities (enames) need to be turned into VLA objects?

Possibly like this?

 

[b][color=Green](setq vlent (vlax-ename->vla-object ent))[/color][/b]

Many thanks for your help! :) :D

Link to comment
Share on other sites

I hope I've got this right, I've never seen any documentation; someone correct me if I'm wrong

 

The parameter of a vlax-curve is the vertex number (kinda). The start parameter of the first vertex (start of curve) is 0. The ParameterAtPoint of the next vertex is 1 (similarly vertex 3= parameter 2...). The ParameterAtPoint of the point midpoint (on the curve) between vertex 1 (parameter 0) and vertex 2 (parameter 1) is 0.5; 3/4 of the way between vertex 2 and 3 would be 1.75.

 

getStartPoint returns the coordinates of the beginning of the curve.

 

AFAIK you need to convert the entity to a vla-object prior to using the vlax-curve functions.

 

I'd probably use something similar to this to return the total length of a vlax-curve

(vlax-curve-getDistAtpoint vlent (vlax-curve-getEndPoint vlent))

Link to comment
Share on other sites

Excellent! Thanks for your help and explanations lpseifert.

 

I understand the parameter functions much better now - it divides the curve into segments using the vertices. Nice.

 

And thank you for providing me with the code.

 

Cheers

 

Lee

Link to comment
Share on other sites

To expand a bit on “Parameter”; lines and polylines appear to share the trait that the startpoint is at Parameter = 0. Entities such as Circles, Arcs and Ellipse have a parametric range that fall within 2Pi. For example, an arc centered at 0,0 with a startpoint 0,10 and endpoint -10, 0, would have a parametric range 1.5708 to 3.1416.

 

For the most part, splines created with AutoCAD would have a parametric range defined at creation, equal to the distance between all of its “FitPoints”. The reason I say defined at creation is because if the Spline were subsequently scaled, the parametric range would remain constant.

 

But, like Arcs and Ellipse, the spline’s range would become truncated if trimmed. Consequently, the spline’s Startpoint may be at a Start Parameter other than 0.

 

I have no direct experience with any of the vlax-curve function but believe they’re derived from ARX AcGeCurve class methods. If that is indeed true then they would likely have the same characteristics as found in Managed Class (.NET).

Link to comment
Share on other sites

Thank you very much SEANT for your clarification in this matter - a parametric range of 0-2pi for circles and arcs and ellipses makes sense.

 

I must say you are a knowledgeable being indeed - are you conversant in LISP, VBA and .NET?

Link to comment
Share on other sites

I would like to add that the value of Parameter for the circle is not limited to 2pi and possible any values including negative (for example -1002.56). You can just be on the circumference of a multiple pi to walk in a circle. Some programs need to verify that the current value of the Parameter is not greater than its value in the end point (2pi).

Link to comment
Share on other sites

Thank you very much SEANT for your clarification in this matter - a parametric range of 0-2pi for circles and arcs and ellipses makes sense.

 

I must say you are a knowledgeable being indeed - are you conversant in LISP, VBA and .NET?

 

 

Actually almost no lisp, and fairly new to .Net.

 

I have done some programming with Rhino 3d which, as a dedicated NURBS program, require extensive use of “Parametric Ranges”. That experience has helped with the learning curve associated with the .NET variant of AutoCAD’s Spline, NURBS, and NURBS Surfaces structures.

 

I do have to concede that the info in ASMI’s post above should be considered more legitimate than mine. I’ve certainly seen enough evidence to trust his recommendations in such matters.

Link to comment
Share on other sites

Thanks for the additional info ASMI, - much appreciated.

 

I trust the info you provide is correct, as, for one, you are a LISP guru, and two, you have a habit of reading help files. :)

 

I assume that if you use a value greater than that of 2pi, LISP will just correct it by factors of 2pi until it lies in the range 0

 

Thanks once again guys.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...