aridzv Posted January 13 Posted January 13 (edited) Hi. I saw a use of that function to get a 3d point at a specific vertex (vertex value pass as integer) as param. the function description from autodesk help: Returns the point at the specified parameter value along a curve (vlax-curve-getPointAtParam curve-obj param) Arguments curve-obj The VLA-object to be measured. param A number specifying a parameter on the curve. how dose the function "know" that param is a vertex and not,for example,a distance or any other numeric charecter of the VLA-object? thanks, aridzv. Edited January 13 by aridzv Quote
devitg Posted January 14 Posted January 14 (edited) 17 hours ago, aridzv said: how dose the function "know" that param is a vertex and not,for example,a distance or any other numeric charecter of the VLA-object? @aridzv, vertices lay at whole or integer PARAM , the start vertice has PARAM = 0 , second vertice is 1.0 , param 0.75 , means a point at 75% distance from PARAM 0 to PARAM 1, and PARAM 2.23 is a point at 23 % distance from PARAM 2 to PARAM 3, this is for POLYLINES, ARCS and CIRCLES, and other "circular" ent 0 is the start PARAM, and 6.28 the end PARAM for circle or ellipse, and what else start and END angle for arcs . Lines have 2 PARAM 0 for start, PARAM x.xxx length for end. PARAM Edited January 14 by devitg add end param for lines Quote
lrm Posted January 14 Posted January 14 A curve (spline) in AutoCAD is defined by a paramteric equation. This means to find a point on the curve you can specify a single parameter and in return you will get the location of a point on the curve. The range of the parameter will be from 0.0 to some upper limit the value of which can be foud as noted here. For example, (setq endSpline (vlax-curve-getEndParam splineObj)) Note that the geometric distance between points of equal parametric spacing are not equal if the curvature is not constant. A curve will have more chords where it has a tighter (smaller) radius. In the image below the red curve shows the location of control vertices for a spline. The three white curves show the evalution of the spline for different numbers of segments (changes in the parameter). Note that the chords that are used to approximate the smooth spline are shorter where the curvature is tighter. You ask "...how dose the function "know" that param is a vertex...". t's not clear what you consider a vertex. The most reasonable vertices to access when dealing with splines are the control vertices. Fit point vertices can become meaningless if the spline is edited. The following will create a list of CVs. (defun c:test (/ ent ed x nlist ) (setq ent (car (entsel "\nSelect spline")) ed (entget ent) ) (FOREACH x ed (IF (EQ 10 (CAR x)) (SETQ nlist (CONS (CDR x) nlist)) ) ) (princ nlist) (princ) ) Quote
Tsuky Posted January 14 Posted January 14 To help understand the behavior of vlax-curve-getPointAtParam, here is a procedure to dynamically display the Param value at the cursor point when the cursor hovers or tries to track over the objects mentioned by@devitg (defun c:dyn_read_param ( / AcDoc Space nw_obj ent_text dxf_ent ncol strcatlst Input obj_sel ename) (setq AcDoc (vla-get-ActiveDocument (vlax-get-acad-object)) Space (if (= 1 (getvar "CVPORT")) (vla-get-PaperSpace AcDoc) (vla-get-ModelSpace AcDoc) ) nw_obj (vla-addMtext Space (vlax-3d-point (trans (getvar "VIEWCTR") 1 0)) 0.0 "" ) ) (mapcar '(lambda (pr val) (vlax-put nw_obj pr val) ) (list 'AttachmentPoint 'Height 'DrawingDirection 'StyleName 'Layer 'Rotation 'BackgroundFill 'Color) (list 1 (/ (getvar "VIEWSIZE") 50.0) 5 (getvar "TEXTSTYLE") (getvar "CLAYER") 0.0 -1 250) ) (setq ent_text (entlast) dxf_ent (entget ent_text) dxf_ent (subst (cons 90 1) (assoc 90 dxf_ent) dxf_ent) dxf_ent (subst (cons 63 255) (assoc 63 dxf_ent) dxf_ent) ncol 0 ) (entmod dxf_ent) (while (and (setq Input (grread T 4 2)) (= (car Input) 5)) (cond ((setq obj_sel (nentselp (cadr Input))) (setq ename (vlax-ename->vla-object (car obj_sel))) (if (not (zerop (apply 'logior (mapcar '(lambda (x) (if (vlax-property-available-p ename x) 1 0) ) '("Length" "ArcLength" "Circumference" "Perimeter" "Area") ) ) ) ) (setq strcatlst (strcat (if strcatlst strcatlst "") "Object Type: " (vlax-get-property ename 'ObjectName) "\nStart Param: " (rtos (vlax-curve-getStartParam ename) 2 4) "\nParam At Point: " (rtos (vlax-curve-getParamAtPoint ename (vlax-curve-getClosestPointTo ename (cadr Input))) 2 4) "\nEnd Param: " (rtos (vlax-curve-getEndParam ename) 2 4) ) ) ) (if strcatlst (mapcar '(lambda (pr val) (vlax-put nw_obj pr val) ) (list 'InsertionPoint 'AttachmentPoint 'Height 'DrawingDirection 'StyleName 'Layer 'Rotation 'TextString) (list (polar (trans (cadr Input) 1 0) (* 1.75 pi) (/ (getvar "VIEWSIZE") 50.0)) 1 (/ (getvar "VIEWSIZE") 50.0) 5 (getvar "TEXTSTYLE") (getvar "CLAYER") 0.0 (strcat "{\\fArial;" strcatlst "}" )) ;"TechnicBold" ) ) (setq strcatlst nil) ) ) ) (vla-Delete nw_obj) (prin1) ) 1 Quote
aridzv Posted January 14 Author Posted January 14 Thanks to all the answers. I figured out from the start that PARAM is a vertex or part of it, i.e if the value of PARAM is 1 the value will be the point at vertex 1, and if te value will be 1.3 so the point will be 0.3 the length of the segment between vertex 1 and 2. but that dosen't reflect in the help section... Quote
Recommended Posts
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.