Ohnoto Posted May 31, 2011 Posted May 31, 2011 We have some code here that inserts blocks based on points in ACAD, and I'm trying to adjust my code for certain points to draw lines. It's a rather long code, so I'm only going to attach that parts specific to drawing a line. ;;;----------------- MyGPSLineLayer MyLineLayer (EXAGS_LineFunction "gps-entrance" "FOC") (defun EXAGS_CreateBaselineSet () (setq exagsBaselineSet (ssget "_X" (list (cons 0 "ARC,CIRCLE,ELLIPSE,LINE,LWPOLYLINE,POLYLINE,SPLINE") (cons 8 "GPS-ROAD,BASELINE,EOG,EOP,FOGLINE,FOC") ))) ) (defun EXAGS_LineFunction (myGPSLineLayer myLineLayer) (if (setq pointSet (ssget "_X" (list (cons 0 "POINT")(cons 8 myGPSLineLayer)))) ; declare the set (pointSet) (progn (setq cntr 0) (while (< cntr (sslength pointSet)) (setq ename (ssname pointSet cntr)) (setq enlist (entget ename)) (setq pt (cdr (assoc 10 enlist))) (setvar "clayer" myLineLayer) (setq pt2 (vlax-curve-getClosestPointto exagsBaselineSet pt)) (command "_pline" pt pt2) (setq cntr (+ cntr 1)) ) ) ) ) Currently, I'm getting an error: unable to get ObjectID: set: 6ca> Any assistance is appreciated, Thanks Quote
VVA Posted May 31, 2011 Posted May 31, 2011 (setq pt2 (vlax-curve-getClosestPointto [color="red"]exagsBaselineSet[/color] pt)) Type of exagsBaselineSet should be vla-object and not Selection set If I understand the problem (defun EXAGS_LineFunction (myGPSLineLayer myLineLayer ObjList) (if (setq pointSet (ssget "_X" (list (cons 0 "POINT")(cons 8 myGPSLineLayer)))) ; declare the set (pointSet) (progn (repeat (setq cntr (sslength exagsBaselineSet)) (setq ObjList (cons (ssname exagsBaselineSet (setq cntr (1- cntr))) ObjList)) ) (setq ObjList (mapcar 'vlax-ename->vla-object ObjList)) (setq cntr 0) (setvar "clayer" myLineLayer) (while (< cntr (sslength pointSet)) (setq ename (ssname pointSet cntr)) (setq enlist (entget ename)) (setq pt (cdr (assoc 10 enlist))) (foreach Obj Objlist (setq pt2 (vlax-curve-getClosestPointto Obj pt)) (command "_pline" "_none" pt "_none" pt2 "") ) (setq cntr (+ cntr 1)) ) ) ) ) Quote
Ohnoto Posted May 31, 2011 Author Posted May 31, 2011 Thanks! There is a small issue occuring, where the line is being drawn, not only to the nearest line, but lines further away as well. 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.