lisp Pick a point in multiple objects closed polyline.

lisp Pick a point in multiple objects closed polyline.

manasi4532
Enthusiast Enthusiast
1,451 Views
18 Replies
Message 1 of 19

lisp Pick a point in multiple objects closed polyline.

manasi4532
Enthusiast
Enthusiast

I have many closed polyline objects that need to be selected internally. How can I select them at once? The desired location is to the left of the closed polyline. When a point is selected I want to enter the distance to move the point to the left. I have also attached a sample file.

0 Likes
Accepted solutions (1)
1,452 Views
18 Replies
Replies (18)
Message 2 of 19

Sea-Haven
Mentor
Mentor

Just a guess of a way, pick outside pline, pick circle, offset is displayed and new offset can be entered. Circle moves.

0 Likes
Message 3 of 19

manasi4532
Enthusiast
Enthusiast

Sorry, I'm not clear. I want to move  green point to the middle polyline. I have hundreds of objects. to move the green point and I'm update Example new file. 

0 Likes
Message 4 of 19

Sea-Haven
Mentor
Mentor

Post Before After dwg, may be difficult to select only a "point" somewhere on left side. 

0 Likes
Message 5 of 19

Kent1Cooper
Consultant
Consultant

Would the Circles you want to move always be green by a color-property override, as those in your sample drawing are?  And would they always be overlapping the rectangle you want them moved off, and the only ones that share those characteristics?  And would the spacing between the inner and outer rectangles always be the same?

Kent Cooper, AIA
0 Likes
Message 6 of 19

manasi4532
Enthusiast
Enthusiast

I have attached a sample file that is closest to the actual work. yes The point I want to move is always green.I want to move the point 2mm to the left. Move only the point on the left . Inside and outside square spacing always the same, same in the example.

0 Likes
Message 7 of 19

Sea-Haven
Mentor
Mentor

So move the "POINT" say to middle of the 2 plines, rather than 2mm.

 

 

(defun c:mpoint ( / p1 oldsnap ss x pl1 pl2 pt pt2 pt3 mp)
(setq p1 nil)
(setq oldsnap (getvar 'osmode))
(setvar 'osmode 0)
(prompt "Select plines and Point Enter to exit  ")
(setq ss (ssget '((0 . "POINT,*LINE"))))
(if (= (sslength ss) 3)
(progn
(repeat (setq x (sslength ss))
  (setq ent (ssname ss (setq x (1- x))))
  (cond
    ((and (= pl1 nil)(= (cdr (assoc 0 (entget ent))) "LWPOLYLINE"))
    (setq pl1 (vlax-ename->vla-object ent)))
    ((= (cdr (assoc 0 (entget ent))) "LWPOLYLINE")
    (setq pl2 (vlax-ename->vla-object ent)))
  )
  (if (= (cdr (assoc 0 (entget ent))) "POINT")
  (progn
    (setq pt (cdr (assoc 10 (entget ent))))
    (setq pent (vlax-ename->vla-object ent))
  )
  )
)
(setq pt2 (vlax-curve-getclosestpointto pl1 pt))
(setq pt3 (vlax-curve-getclosestpointto pl2 pt))
(setq mp (mapcar '* (mapcar '+ pt2 pt3) '(0.5 0.5)))
(vlax-put pent 'Coordinates mp)
)
(alert "\nPicked to many items \n \nplease try again")

)
(setvar 'osmode oldsnap)
(princ)
)
(c:mpoint)

 

 

 

0 Likes
Message 8 of 19

manasi4532
Enthusiast
Enthusiast

It can't be used. coder error :Incorrect number of elements in SafeArray.

0 Likes
Message 9 of 19

Sea-Haven
Mentor
Mentor

When asked to select see image below use pick to right 1st then to left so select the 2 plines and the POINT. Its not a do all rather a 1 at a time.

SeaHaven_1-1683855715229.png

 

 

0 Likes
Message 10 of 19

manasi4532
Enthusiast
Enthusiast

It still doesn't work. I clicked the right area once and dragged over the polyline and point and clicked on the left side. But still can't use it.  i use it 2ployline and one point

0 Likes
Message 11 of 19

Sea-Haven
Mentor
Mentor

Working for me and tested on your sample dwg, multiple times, did you pick a spot where you have the red arrow line ? This will cause an error as you get 4 objects. 

 

Ok pick when asked the 2 plines and the POINT individually, then Enter. Did it work for you ?

0 Likes
Message 12 of 19

manasi4532
Enthusiast
Enthusiast

2023-05-12-13-11-36.gif

 

Am I doing something wrong?

0 Likes
Message 13 of 19

Sea-Haven
Mentor
Mentor

Please post the dwg your testing with so I can have a look, its working for me.

0 Likes
Message 14 of 19

komondormrex
Mentor
Mentor

what do you need exactly? you have groups of 2 plines and few points between plines. your objective is to pick a raw point between plines for all plines and points in a group to be selected and moved or else?

0 Likes
Message 15 of 19

manasi4532
Enthusiast
Enthusiast

It's the same file I gave you above.

0 Likes
Message 16 of 19

manasi4532
Enthusiast
Enthusiast

I want to move only one green point to the left of the object. between 2 polylines, move 2mm to the left

 

"I have hundreds of objects that I want to move only the green points that are between two lines and on the left side of the polyline. I want to find a way that makes me solve the problem faster."

move only green point on the left side of polyline

0 Likes
Message 17 of 19

komondormrex
Mentor
Mentor
Accepted solution

such as?

(while t
	(if (null distance_to_left) (setq distance_to_left 2.0))
	(setq point_to_move (vlax-ename->vla-object (ssname (ssget "_:s" '((0 . "point") (62 . 3))) 0))
		  init (initget 1)
		  distance_to_left (getreal (strcat "\nEnter distance to move point to the left <" (rtos distance_to_left) ">: "))
	)
	(vla-move point_to_move
		(vla-get-coordinates point_to_move)
		(vlax-3d-point (mapcar '- (vlax-get point_to_move 'coordinates) (list distance_to_left 0)))
	)
)

 

0 Likes
Message 18 of 19

Sea-Haven
Mentor
Mentor

All I can say is its working for me in Bricscad will test in Acad, other thing is set Lispsys to 1.

 

Could some one else test please and let me know. 

0 Likes
Message 19 of 19

manasi4532
Enthusiast
Enthusiast

It's pretty good. But I have to type 2 enter every time.

0 Likes