Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/14/2020 in all areas

  1. (setq s (ssget '((0 . "*LINE") (6 . "~Continuous"))))
    1 point
  2. Once you have wrangled it into Paperspace, and set the location as suggested, check and make sure that it is on the appropriate layer. This would also be the correct time to check a few other considerations, such as Dimension Style or styles you might generally favor, default Layers that you might wish to include in your new Template, current Text style, Leader Styles, etc. Personally I would also make sure that my Current Layer was set to 0. Once you feel pretty good about it, SAVEAS .DWT and give it an appropriate name. Should you want to make this your new Default QNEW drawing, that can be done as in the screenshot.
    1 point
  3. OK, try this (defun rh:gbbu (obj / ll ur lst) (vlax-invoke-method obj 'getboundingbox 'll 'ur) (setq lst (mapcar 'vlax-safearray->list (list ll ur))) (cadr lst) );end_defun (vl-load-com) (defun c:test ( / sel ent el ur obj nobj lst ept npt) (while (setq sel (entsel "\nSelect Leader Text : ")) (setq el (entget (setq ent (car sel))) ur nil) (cond ( (= (cdr (assoc 0 el)) "TEXT") (setq ur (rh:gbbu (vlax-ename->vla-object ent)))) ( (= (cdr (assoc 0 el)) "MTEXT") (setq obj (vlax-ename->vla-object ent) nobj (vla-copy obj) ); (vl-cmdf "explode" (vlax-vla-object->ename nobj) "") (setq nobj (vlax-ename->vla-object (entlast)) ur (rh:gbbu nobj) );end_setq (vla-delete nobj) ) );end_cond (cond (ur (setq el (entget (setq ent (car (entsel "\nSelect Leader : "))))) (cond ( (= (cdr (assoc 0 el)) "LEADER") (setq obj (vlax-ename->vla-object ent) lst (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) el)) ept (last lst) lst (cdr (reverse lst)) npt (list (car ur) (cadr ept) (caddr ept)) lst (reverse (cons npt lst)) ) (vlax-put obj 'coordinates (apply 'append lst)) ) );end_cond ) );end_cond );end_while (princ) );end_defun This works on your supplied drawing, and if the leader and text orientation are the same. You are ask to select the Leader Text, This can be "TEXT" or "MTEXT". You are then asked to select the Leader. This can only be a "LEADER" not an "MULTILEADER" The loop will continue until you make a null selection (select a blank area of the screen) on the "Select Leader Text" prompt
    1 point
  4. Try (defun c:test ( / s ) (princ "\nSelect Block: ") (if (setq s (ssget "_+.:E:S" '((0 . "INSERT")))) (LM:ApplytoBlockObjects (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))) (vla-get-effectivename (vlax-ename->vla-object (ssname s 0))) '(lambda ( obj ) (if (= "AcDbWipeout" (vlax-get obj 'objectname)) (LM:movetobottom (list obj)))) ) ) (princ) ) (vl-load-com) (princ) This will not alter dynamic blocks or some blocks with attributes as these will be anonymous and the routine gets the effectivename property which will point to the parent block. If you want it to work on anonymous blocks change (vla-get-effectivename ...) to (vla-get-name...)
    1 point
  5. Hi, Here is one way and the simplest one. (defun c:Test ( / sel) ;; Tharwat - 11.Sep.2020 ;; (and (princ "\nSelect a block: ") (setq sel (ssget "_+.:S:E:L" '((0 . "INSERT")))) (progn (command "_.bedit" (cdr (assoc 2 (entget (ssname sel 0))))) (if (setq sel (ssget "_X" '((0 . "~WIPEOUT")))) (command "_.draworder" sel "" "Front") ) (if (setq sel (ssget "_X" '((0 . "WIPEOUT")))) (command "_.draworder" sel "" "Back") ) (command "_.bclose" "Save") ) ) (princ) )
    1 point
  6. Many thanks for the drawing, it was a big help. The problem was with the text width. It was picking up the width of the MTEXT text box, which I though I had accounted for. This should now work correctly. I was previously storing all the selected entities in a list to make deleting them easier. The lisp now checks any selected entity against the list. If you have already selected it a pop up alert will tell you it has already been selected. Hope this now works as you require. (defun rh:em_txt ( pt txt lyr sty tht xsf) (entmakex (list '(0 . "TEXT") '(100 . "AcDbEntity") '(100 . "AcDbText") (cons 10 pt) (cons 1 txt) (if lyr (cons 8 lyr)) (if sty (cons 7 sty)) (if tht (cons 40 tht)) (if xsf (cons 41 xsf)) );end_list );end_entmakex );end_defun (vl-load-com) (defun c:t+ ( / *error* ent elst el num xsf tot nlst sel pt txt) (defun *error* ( msg ) (if (not (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*EXIT*")) (princ (strcat "\nAn Error : " msg " occurred."))) (princ) );end_defun (while (not tot) (setq el (entget (setq ent (car (entsel "\Select First Text Number Entity : "))))) (cond ( (wcmatch (cdr (assoc 0 el)) "*TEXT") (cond ( (= (cdr (assoc 0 el)) "TEXT") (setq num (atof (getpropertyvalue ent "TextString")) xsf (cdr (assoc 41 el)))) (t (setq num (atof (getpropertyvalue ent "Text")) xsf 1.0)) );end_cond (cond ( (zerop num) (setq num nil) (alert "Text Entity NOT a number")) (t (setq tot num))) ) (t (alert "Not a Text Entity")) );end_cond (cond (num (setq nlst (cons ent nlst)))) );end_while (while (setq sel (entsel "\nSelect Next Text Number Entity : ")) (setq elst (entget (setq ent (car sel)))) (cond ( (and (wcmatch (cdr (assoc 0 elst)) "*TEXT") (not (vl-position ent nlst))) (cond ( (= (cdr (assoc 0 elst)) "TEXT") (setq num (atof (getpropertyvalue ent "TextString")))) (t (setq num (atof (getpropertyvalue ent "Text")))) );end_cond (cond ( (zerop num) (setq num nil) (alert "Text Entity NOT a number"))) ) ( (vl-position ent nlst) (alert "Already Selected")) (t (alert "Not a Text Entity")) );end_cond (if num (setq tot (+ tot num) nlst (cons ent nlst) num nil)) );end_while (cond (tot (setq pt (getpoint "\nSelect Total Insertion Point : ") txt (if (zerop (rem tot 1.0)) (rtos tot 2 0) (rtos tot 2 3)) );end_setq (rh:em_txt pt txt (cdr (assoc 8 el)) (cdr (assoc 7 el)) (cdr (assoc 40 el)) xsf) (if nlst (foreach o (mapcar 'vlax-ename->vla-object nlst) (vla-delete o))) ) );end_cond (princ) );end_defun
    1 point
×
×
  • Create New...