Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/29/2025 in Posts

  1. As a spline gives two answers the points answer and another with nodes. So any way if you explode the Mleader then you can get at the spline using this. Just need to check that the spline is last entity, tested in Bricscad. A disclaimer not sure if length is correct. I think it is short by length of arrow. Will try to find arrow length. Yep found it. (defun c:wow ( / plent pt len lenar) (setq plent (entsel "\nPick mleader ")) (setq lenar (cdr (assoc 140 (entget (car plent))))) (command "undo" "M") (command "explode" (car plent)) (setq ent (ssname (ssget "L") 0)) (setq len (getpropertyvalue ent "length")) (command "undo" "B") (alert (strcat "Total length is " (rtos (+ lenar len) 2 3))) (princ) ) (c:wow) I think you could do a "I want a length of 100 by drawing something close then move say arrow point till you get approx 100. Via lisp. It would be a two step process explode and move then undo and reset arrow head point.
    1 point
  2. LOL! Only for items that look difficult, or painful in lisp, where there’s a possible built in function. This drawing took 0.03673760 seconds to process. if the drawing is indeed correct, have a look here for how to run python https://github.com/CEXT-Dan/PyRx arc2.dwg
    1 point
  3. That sounds to me that you are trying to pull us to the dark side, sounds pretty tempting, would you walk us through?
    1 point
  4. Try this. Not sure what you want for attribute values. Can ask once then will be added correctly. Maybe 3 getstring after pick pline. ; https://www.cadtutor.net/forum/topic/98666-block-insert-lisp/ ; arrows by AlanH Aug 2025 (defun c:wow ( / plent co-ord isclosed x obj ang) ;; Set Dynamic Block Property Value - Lee Mac ;; Modifies the value of a Dynamic Block property (if present) ;; blk - [vla] VLA Dynamic Block Reference object ;; prp - [str] Dynamic Block property name (case-insensitive) ;; val - [any] New value for property ;; Returns: [any] New value if successful, else nil (defun LM:setdynpropvalue ( blk prp val ) (setq prp (strcase prp)) (vl-some '(lambda ( K ) (if (= prp (strcase (vla-get-propertyname k))) (progn (vla-put-value K (vlax-make-variant val (vlax-variant-type (vla-get-value K)))) (cond (val) (t)) ) ) ) (vlax-invoke blk 'getdynamicblockproperties) ) ) (setq plent (entsel "\nPick pline")) (setq co-ord (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget (car plent))))) (setq isclosed (cdr (assoc 70 (entget (car plent))))) (setq x 0) (command "-insert" "Stalb" (nth x co-ord) 1 1 0 "" "" "") (setq obj (vlax-ename->vla-object (entlast))) (setq ang (angle (nth x co-ord) (nth (+ x 1) co-ord))) (LM:setdynpropvalue obj "Angel_1" ang) (if (= isclosed 1) (progn (setq ang (angle (nth 0 co-ord) (last co-ord) )) (LM:setdynpropvalue obj "Angel_2" ang) ) ) (repeat (- (length co-ord) 2) (command "-insert" "Stalb" (nth (setq x (1+ x)) co-ord) 1 1 0 "" "" "") (setq obj (vlax-ename->vla-object (entlast))) (setq ang (angle (nth x co-ord) (nth (+ x 1) co-ord))) (LM:setdynpropvalue obj "Angel_1" ang) (setq ang (angle (nth x co-ord) (nth (- x 1) co-ord))) (LM:setdynpropvalue obj "Angel_2" ang) ) (command "-insert" "Stalb" (nth (setq x (1+ x)) co-ord) 1 1 0 "" "" "") (setq obj (vlax-ename->vla-object (entlast))) (setq ang (angle (nth x co-ord) (nth (- x 1) co-ord))) (LM:setdynpropvalue obj "Angel_2" ang) (if (= isclosed 1) (progn (setq ang (angle (nth x co-ord) (nth 0 co-ord) )) (LM:setdynpropvalue obj "Angel_1" ang) ) ) (princ) )
    1 point
  5. Did you try this ? https://www.cadtutor.net/forum/topic/76319-add-block-onto-polyline-vertices/
    1 point
  6. My version, also for Dynamic&Anonymous blocks. ;;; file: RB_en.lsp ;;; ;;; data: 22/10/2008 ;;; ;;; note: Rename the selected block. ;;; ;;; ;;; ;;; aggiornamento: (Versione 2) - 01/04/2009 ;;; ;;; - default sulla casella OK ;;; ;;; - controllo esistenza nome blocco ;;; ;;; ;;; ;;; aggiornamento: (Versione 3) - 02/04/2009 ;;; ;;; - allargata casella editazione nome blocco ;;; ;;; ;;; ;;; aggiornamento: (Versione 4) - 28/10/2012 ;;; ;;; - rinomina blocchi dinamici e blocchi anonimi ;;; ;;; - creazione di blocchi anonimi ;;; ;;; - inglobamento DCL nel lisp ;;; ;;; ;;; ;;; aggiornamento: (V. 4_en) - 20/05/2013 ;;; ;;; - English Version (for CADTutor) ;;; ;;; ;;; ;;; autore: Gian Paolo Cattaneo ;;; (defun c:RB (/ :bb old new dcl_id) (prompt "\n ") (prompt "\n ") (prompt "\n ") (if (while (not :bb) (setvar 'errno 0) (setq :bb (car (entsel "\nSelect block to RENAME:"))) (if (= 7 (getvar 'errno)) (alert "Nothing selected. Try again.") ) (if (= 'ename (type :bb)) (if (null (wcmatch (cdr (assoc 0 (entget :bb))) "INSERT")) (progn (alert "Item selected is not a block.") (setq :bb nil) ) (progn (setq old (vla-get-effectivename (vlax-ename->vla-object :bb))) ) ) ) ) (progn (RB_dcl) (while (and (/= (strcase old) (strcase new)) (tblsearch "BLOCK" new) ) (alert "A block with this name already exists") (RB_dcl) ) (vla-put-Name (vla-item (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object) ) ) old ) new ) ) ) (prompt "\n ") (prompt "\n ") (prompt "\n ") (princ) ) (defun RB_dcl ( / DCLname) (setq DCLname (strcat (getvar 'localrootprefix) "RB_V4_en.dcl")) (if (not (findfile DCLname)) (crea_dcl_RB)) (if (= POSIZ_DCL_RB nil) (setq POSIZ_DCL_RB (list -1 -1))) (setq dcl_id (load_dialog DCLname)) (if (not (new_dialog "RB4" dcl_id "" POSIZ_DCL_RB)) (exit)) (setq new old) (set_tile "new" new) (action_tile "new" "(setq new $value)") (start_dialog) (unload_dialog dcl_id) ) (defun crea_dcl_RB (/ fn f) (setq fn DCLname) (setq f (open fn "w")) (write-line "RB4:dialog {" f) (write-line "label = \"RB - Rename Block (Vers. 4_en)\";" f) (write-line "" f) (write-line " initial_focus=\"new\";" f) (write-line "" f) (write-line " : spacer {}" f) (write-line " : spacer {}" f) (write-line " : spacer {}" f) (write-line "" f) (write-line " : text {" f) (write-line " label = \"New Block Name:\";" f) (write-line " alignment = centered;" f) (write-line " } " f) (write-line "" f) (write-line " : text {" f) (write-line " label = \"(type: *U to create an Anonymous Block)\";" f) (write-line " alignment = centered;" f) (write-line " } " f) (write-line "" f) (write-line " : spacer {}" f) (write-line "" f) (write-line " : edit_box {" f) (write-line " key=\"new\";" f) (write-line " allow_accept=true;" f) (write-line " }" f) (write-line "" f) (write-line " : spacer {}" f) (write-line " : spacer {}" f) (write-line " : spacer {}" f) (write-line "" f) (write-line " ok_only;" f) (write-line "" f) (write-line " : spacer {}" f) (write-line " : spacer {}" f) (write-line " : spacer {}" f) (write-line "" f) (write-line " : text { " f) (write-line " label = \"Copyright © 2012 - Gian Paolo Cattaneo\";" f) (write-line " alignment = centered;" f) (write-line " }" f) (write-line "" f) (write-line "}" f) (close f) (load_dialog fn) ) ;****************************************************************************** (vl-load-com) (prompt "\n ") (prompt "\n ") (prompt "\n ") (princ "\nRename Block (V.4_en) - by Gian Paolo Cattaneo") (princ "\nType RB to Start") (princ)
    1 point
×
×
  • Create New...