All Activity
- Past hour
-
Look for Notepad your Acad.pgp make code even shorter. This the bat file I use. d: cd\alan\lisp findstr %1 *.lsp
-
Tharwat started following Need help with attributes count table
-
Need help with attributes count table
Tharwat replied to aridzv's topic in AutoLISP, Visual LISP & DCL
You can private message me if you are after a custom program. - Today
-
drmemo345 joined the community
-
reza started following Change Qleader Setting via Command Line
-
dimension Change Qleader Setting via Command Line
reza posted a topic in AutoLISP, Visual LISP & DCL
Hi everyone When I open a dwg file and use the attached lisp to change the Qleader settings, no changes are made to the settings. Please fix the problem for me. qlset.lsp.lsp test.dwg -
Attribute that updates based on location
EYNLLIB replied to EYNLLIB's topic in AutoLISP, Visual LISP & DCL
(defun update-attributes ( / bln idx ins map obj sel tag val ) (setq ;; List of ;; ((lower-left point) (upper-right point) "attribute value") map '( ((-1179.5 -1006.0) (1179.5 1006.0) "S3.0") ) ;; Block name bln "Detail Cut" tag "SHEETNUMBER" ) (setq bln (strcase bln) tag (strcase tag) ) (if (setq sel (ssget "_X" (list '(0 . "INSERT") '(66 . 1) (cons 2 (strcat "`*U*," bln))))) (repeat (setq idx (sslength sel)) (setq idx (1- idx) obj (vlax-ename->vla-object (ssname sel idx)) ) (if (= bln (strcase (vlax-get-property obj (if (vlax-property-available-p obj 'effectivename) 'effectivename 'name)))) (progn (setq ins (vlax-get obj 'insertionpoint) val (vl-some '(lambda ( itm ) (if (vl-every '<= (car itm) ins (cadr itm)) (caddr itm))) map) ) (if val (vl-some '(lambda ( att ) (if (= tag (strcase (vla-get-tagstring att))) (progn (if (vlax-write-enabled-p att) (vla-put-textstring att val) ) t ) ) ) (vlax-invoke obj 'getattributes) ) ) ) ) ) ) (princ) ) (defun block-position-callback ( rtr arg ) (if (and arg (wcmatch (strcase (car arg) t) "qsave,save,saveas,plot,publish,regen,regenall")) (update-attributes) ) (princ) ) ( (lambda ( key ) (vl-load-com) (foreach rtr (cdar (vlr-reactors :vlr-command-reactor)) (if (= key (vlr-data rtr)) (vlr-remove rtr) ) ) (vlr-set-notification (vlr-command-reactor key '( (:vlr-commandwillstart . block-position-callback) ) ) 'active-document-only ) (update-attributes) (princ) ) "block-position-reactor" ) For whatever reason the code you posted wasn't agreeing with my CAD. I inverted the logic to test if true, and added a nil guard to ensure attributes are only updated when a valid value is found in the area map Thanks for pointing me in the right direction! - Yesterday
-
Eymard Sosa joined the community
-
Precisely selecting with a window
Discus84 posted a topic in AutoCAD 2D Drafting, Object Properties & Interface
Hi, Very often the selection window is large enough for the drawing to be really zoomed out. In this case it's hard to point the window exactly where it should be. Zooming in is not possible because whatever is not on the screen will not be selected. Am I missing something here? Is there a way to zoom in and for the window to still catch whatever is not on the screen? Thanks. Lu -
I think the best way to explain it is to include a picture of the DIMENSION before and after it was modified. Although perhaps other, more awake minds than mine have already understood it.
-
@GLAVCVS IT'S OKAY, I JUST NEED IT WITHOUT HAVING TO ADD THE TEXT TO THE BEGINNING, SO TEXTS 1 AND 2 WILL ALREADY BE DEFINED WITHIN THE ROUTINE I mean I just select a dimension and the result is... true dimension accompanied by the "+" sign and below the line "text 1" and below this "text 2" (defun c:dimsub ( / enx grp idx new pos sel str ) (princ "\nColoca subfijo a dimension por debajo de linea con opcion de cambio") (if (setq sel (ssget "_:L" '((0 . "*DIMENSION")))) (repeat (setq idx (sslength sel)) (setq idx (1- idx) enx (entget (ssname sel idx)) grp (assoc 1 enx) ) (if (setq pos (vl-string-search "\\X" (cdr grp))) (setq new (cons 1 (strcat (substr (cdr grp) 1 pos) "\\X" str))) (setq new (cons 1 (strcat "+" "<>\\X" "TEXT 1))) ) (entmod (subst new grp enx)) ) ) (princ) ) this routine is from the master @Lee Mac I mean I'm looking to add a second line
-
Need help with attributes count table
3arizona replied to aridzv's topic in AutoLISP, Visual LISP & DCL
@Tharwat Sorry for opening this old post. Lisp works perfect but i get an error when extracting my dynamic block. My block has other visibilities do not share the same tag names. Is there a way for the lisp to read the current visibility? -
@leonucadomi You should copy the code again. I changed a small thing to prevent NOMUTT from staying at 1.
-
To add all the text lines you need
-
Another option (defun c:subTexta (/ e le txa tx cj para) (if (/= (setq tx (getstring "\nType TEXT to add?: ")) "") (while (setq n (not (setvar "NOMUTT" 1)) x (princ (strcat "\rAdd \'" tx "\' to DIMENSIONs...")) cj (ssget "_:L" '((0 . "*DIMENSION")))) (while (setq e (ssname cj (setq n (if n (1+ n) 0)))) (entmod (subst (cons 1 (cond ((or (wcmatch (setq txa (cdr (assoc 1 (setq le (entget e))))) "*<>\n*") (wcmatch txa "*<>\\X*")) (strcat txa "\n" tx)) (T (strcat txa "<>\\X" tx)))) (assoc 1 le) le ) ) ) ) ) (setvar "NOMUTT" 0) (princ) )
-
I NEED TO ADD A SECOND TEXT BELOW THE FIRST
-
master , I am trying to do the following (defun c:dimsub ( / enx grp idx new pos sel str ) (princ "\nColoca subfijo a dimension por debajo de linea con opcion de cambio") ; (if (= "" (setq str (getstring t "\nSpecify string <TYP>: "))) ;(setq str "TYP") ; ) (if (setq sel (ssget "_:L" '((0 . "*DIMENSION")))) (repeat (setq idx (sslength sel)) (setq idx (1- idx) enx (entget (ssname sel idx)) grp (assoc 1 enx) ) (if (setq pos (vl-string-search "\\X" (cdr grp))) (setq new (cons 1 (strcat (substr (cdr grp) 1 pos) "\\X" str))) (setq new (cons 1 (strcat "+" "<>\\X" "TEXT 1"))) ) (entmod (subst new grp enx)) ) ) (princ) )
-
But if you were curious as to what the entmake route looks like - consider the following thread: https://www.theswamp.org/index.php?topic=20446
-
You're right. The file opens now. Thank you again.
-
dilan yıldırım joined the community
-
@CyberAngel I'm having recurring issues with the open file history in Visual Lisp. I asked about this issue here a while back. @rlx explained that the history is stored in the vlide.dsk file. I tried using the GLAVCVS code to open it.
-
Lee Mac started following Field
-
If you wish to entmake a field, you need to also entmake the FIELD entity within the TEXT entry of the ACAD_FIELD dictionary found within the extension dictionary attached to the entity - this is theoretically possible, but a lot of work and wheel reinvention. Instead, if you either create the MText object using vla-addmtext or convert the MTEXT entity into a VLA object and set the textstring property to a field expression, the CAD platform will automatically parse the field expression and configure the corresponding dictionaries for you.
-
And try again
-
It’s possible that vlide.dsk is not located in AutoCAD’s Support File Search Path. Find it using Windows Explorer and add its location to AutoCAD’s Support File Search Path.
-
THANK YOU SIR
-
Not sure what you're trying to do. VLIDE is an AutoCAD command to open the Visual Lisp Integrated Development Environment.
-
enis_013 joined the community
-
@GLAVCVS I type vlide@dsk in the command line, but it doesn’t do anything.
-
(defun c:bm () ;code;;;;;;;; (setq s (car(entsel))) (if s (progn (setq ar (vlax-ename->vla-object s)) (setq area (vla-get-Area ar)) (setq p (getpoint "\nselect point")) (entmakex (list (cons 0 "MTEXT") (cons 100 "AcDbEntity") (cons 100 "AcDbMText") (cons 10 p) (cons 40 0.3) (cons 71 5) (cons 1 (strcat "%<\\AcObjProp.16.2 Object(%<\\_ObjId " (itoa (vla-get-objectid ar)) ">%).Area \\f \"%lu2%pr2%ps\">%" ) ) (cons 7 "Standard") (cons 73 1) ) ) ) ; end progn ) ;code;;;;;;;; ) This part of the code displays the object area as: <\AcObjProp.16.2 Object(%<\_ObjId 2401165245680>%).Area \f "%lu2%pr2%ps" in AutoCAD model space. If you double-click on the text, it will show the object area. (example 100.00)
-
You could make them blocks, update one, the rest update. The best IMO would be, as mentioned by CyberAngel, custom properties that can be referenced by fields. You could also use LISP, etc., but since you mentioned fields, the custom properties and fields might be easier for you.
-
TDJ1992 joined the community
-
Laverne Elgar joined the community
-
Degomtoo joined the community
-
Is there a way to Crop images inserted into a dwg?
Ykozkaynak replied to Rosco's topic in AutoCAD General
Let me give you update from 8 more years, it helped me today! I hope someone sends a notification from 2033 too Or i will become the last ghost here...