Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/12/2019 in all areas

  1. Wow - I don't think there is much more to add than that.
    1 point
  2. I just tested again and working fine is the angle of the text such that a intersection point is not visually calculated ? This will force a calculation extending lines replaced in code above (setq intpt (vlax-invoke obj 'intersectWith obj4 acExtendboth))
    1 point
  3. A simple make a list of points. (setq lst '()) (while (setq pt (getpoint "Pick point Enter to exit")) (setq lst (cons pt lst)) ) ; now make table and fill in I did a google for "put list into table lisp" just scroll down a bit and answer is there.
    1 point
  4. Try this (defun rh:sammlung_n (o_lst grp / tmp n_lst) (setq n_lst nil) (cond ( (and o_lst (= (rem (length o_lst) grp) 0)) (while o_lst (repeat grp (setq tmp (cons (car o_lst) tmp) o_lst (cdr o_lst))) (setq n_lst (cons (reverse tmp) n_lst) tmp nil) );end_while ) );end_cond (if n_lst (reverse n_lst)) );end_defun (vl-load-com) ;; Move Text to Line along text rotation (defun c:MT2L ( / *error* c_doc c_spc l_obj ent e_lst ss t_obj i_pt t_rot x_obj x_pts s_d x_pt) (defun *error* ( msg ) (if (not (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*EXIT*")) (princ (strcat "\nOops an Error occurred : " msg))) (princ) );end_defun *error* (setq c_doc (vla-get-activedocument (vlax-get-acad-object)) c_spc (vlax-get-property c_doc (if (= 1 (getvar 'cvport)) 'paperspace 'modelspace)) );end_setq (while (not l_obj) (setq ent (car (entsel "\nSelect Line : ")) e_lst (entget ent) );end_setq (if (vl-position (cdr (assoc 0 e_lst)) (list "ARC" "LINE" "LWPOLYLINE" "RAY" "SPLINE" "XLINE")) (setq l_obj (vlax-ename->vla-object ent))) );end_while (setq ss (ssget '((0 . "*TEXT")))) (repeat (setq cnt (sslength ss)) (setq t_obj (vlax-ename->vla-object (ssname ss (setq cnt (1- cnt)))) i_pt (vlax-get t_obj 'insertionpoint) t_rot (vlax-get t_obj 'rotation) x_obj (vlax-invoke c_spc 'addxline i_pt (polar i_pt t_rot 1.0)) x_pts (rh:sammlung_n (vlax-invoke x_obj 'intersectwith l_obj acextendnone) 3) s_d 1.0e200 );end_setq (cond ( (> (length x_pts) 1) (foreach pt x_pts (if (< (distance pt i_pt) s_d) (setq x_pt pt s_d (distance pt i_pt))))) (t (setq x_pt (car x_pts))) );end_cond (vlax-invoke t_obj 'move i_pt x_pt) (vla-delete x_obj) );end_repeat (princ) );end_defun It will move the text to the nearest intersection (if more than 1) using the text angle. See attached dwg MT2L.dwg
    1 point
  5. How is it not working? What error message are you getting? Are you trying to use this with a polyline or a line? If with a polyline try it with a line. Is the visual lisp arx loaded? If not put (vl-load-com) at the top of the file and try again
    1 point
  6. As the OP wants to move to a line or pline I can see a problem arising if the xline cuts the pline more than once, when intpt will become a list min length 6 (2 points), so you would have to find the nearest intersection point.
    1 point
  7. Are you happy with move based on angle of text ? This would use a xline and intersectwith ; By Alan H Oct 2019 ; moves text along text angle to a *line (vl-load-com) (defun c:pushtxt ( / ss ang obj obj2 obj4 pt1 pt2 pt3 ent) (setq obj (vlax-ename->vla-object (car (entsel "pick Line ")))) (setq ss (ssget (list (cons 0 "*text")))) (repeat (setq x (sslength ss)) (setq ent (ssname ss (setq x (- x 1)))) (setq obj2 (vlax-ename->vla-object ent )) (setq Pt1 (vlax-get Obj2 'Insertionpoint)) (setq ang (vlax-get Obj2 'rotation)) (setq pt3 (polar pt1 ang 10)) (command "xline" pt1 pt3 "") (setq obj4 (vlax-ename->vla-object (entlast))) (setq intpt (vlax-invoke obj 'intersectWith obj4 acExtendboth)) (vla-delete obj4) (command "move" ent "" pt1 intpt) ) ) (c:pushtxt)
    1 point
  8. This was asked here a little while ago will repeat my suggestion just use a normal dimension style but with ext lines etc turned off it will auto update.
    1 point
×
×
  • Create New...