Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/20/2020 in all areas

  1. a bit rough and ready, but try this (defun c:movec ( / dst ent obj tmp ss cnt elst i_pt c_pt) (initget 7) (setq dst (getreal "\nEnter Distance to Move : ") ent (car (entsel "\nSelect Polyline : ")) obj (vlax-ename->vla-object ent) tmp (car (vlax-invoke obj 'offset dst)) );end_setq (cond ( (> (vlax-get tmp 'area) (vlax-get obj 'area)) (setq dst (* dst -1.0)))) (vla-delete tmp) (prompt "\nSelect Circles : ") (setq ss (ssget ":L" '((0 . "CIRCLE")))) (cond (ss (setq tmp (car (vlax-invoke obj 'offset dst))) (repeat (setq cnt (sslength ss)) (setq ent (ssname ss (setq cnt (1- cnt))) elst (entget ent) i_pt (reverse (cdr (reverse (cdr (assoc 10 elst))))) c_pt (vlax-curve-getclosestpointto tmp i_pt) );end_setq (entmod (subst (cons 10 c_pt) (assoc 10 elst) elst)) );end_repeat (vla-delete tmp) ) );end_cond );end_defun
    1 point
  2. What if the circle is located at the vertex of the polyline? Offset it at half the angle formed between the two lines?
    1 point
  3. Try to enter negative distance Also I see not all the circles are moved. Are you sure all the center points lay *exactly* on the polyline?
    1 point
  4. (defun c:pp() (setq p (car (entsel "Polyline?"))) (setq ssC (ssget "X" (list (cons 0 "Circle")))) (setq dist (getdist " distance?")) (setq pl(entget p) pl (member (assoc 10 pl) pl) points nil) (while pl (setq points (cons (cdar pl) points) pl (cdr pl) pl (member (assoc 10 pl) pl)) ) (setq i 0) (repeat (1- (length points)) (setq A (nth i points) B (nth (setq i (1+ i)) points)) (repeat (setq j (sslength ssC)) (setq C (cdr (assoc 10 (entget (setq M (ssname ssC (setq j (1- j)))))))) (if (= (distan A B) (+ (distan A C) (distan C B))) (move M A C dist)) ) ) ) (defun distan (a b / c d) (setq c (- (car a) (car b)) d (- (cadr a) (cadr b))) (sqrt (+ (* c c) (* d d))) ) (defun move (e a b dist) (setq p (polar (cdr (assoc 10 (entget e))) (+ (/ PI 2.0) (angle a b)) dist)) (setq el (entget M) el (subst (cons 10 p) (assoc 10 el) el) el (entmod el)) ) Wrote it in a hurry... it can be improved, but first give me a feed-back to be sure it's what you need.
    1 point
  5. Yes, it's very possible. One query, do the polylines have any bulges on them? Or any curves? If not, then I might just do ssget F on each vertex to select the circles.
    1 point
  6. 1 point
  7. Insert dwg at 0,0 explode once then purge block other dwg name, not much simpler.
    1 point
  8. Many ways to do this, Tharwat wrote one with leaders from text placement to the point: https://www.cadtutor.net/forum/topic/68126-require-lisp-3-in-1-for-xyz-coordinates-with-leader/?tab=comments#comment-552696 another: https://www.cadtutor.net/forum/topic/62823-xy-coordinates-for-a-selected-object/?tab=comments#comment-518368
    1 point
×
×
  • Create New...