Leaderboard
Popular Content
Showing content with the highest reputation on 04/08/2025 in Posts
-
@Steven P nice... somewhat old but very useful... I added a few small things that make it a little more convenient for me, and maybe for others too... Great lisp!! ;;https://forums.autodesk.com/t5/autocad-forum/having-trouble-with-the-lisp-that-zooms-a-rectangle-that-fits-in/td-p/9378532 ;; draw rectangle aroud the viewport,copy the rectangle to model space where you need to print. ;; for 1:1 (1:1000m) don't scale. for 1:1250 scale 1.25 etc' (defun c:zvprect1 ( / *error* trap1 olderr a b e o) ;; I renamed this to fit my brain: 'z' - zoom, 'vp' - viewport, 'rect' - rectangle (defun trap1 ( msg ) (command "._PSPACE") (setq *error* olderr); restore *error* symbol (princ) ) (setq olderr *error*); assign current function defintion held by the *error* symbol to a local variable - olderr (setq *error* trap1); pointing the *error* symbol to new function definition - trap1 (command "._MSPACE") (if (setq e (car (entsel "\nSelect Rectangle : "))) (progn (setq o (vlax-ename->vla-object e)) (vlax-invoke-method o 'GetBoundingBox 'a 'b) (setq a (vlax-safearray->list a)) (setq b (vlax-safearray->list b)) (vl-cmdf "_.zoom" a b) );progn );if (command "._PSPACE") (setq *error* olderr); restore *error* symbol (princ) )1 point
-
If achieving zoom extensions is so important and you can't do it any other way, the quickest solution might be to write a DXF and define the initial view in it. But I suppose you'd have to find a simpler solution.1 point
-
I didn't look into what your code is doing, but if you use QNEW, focus goes to the new drawing.1 point
-
This is a way that I have found to do it: 1) Start the LISP that will open the new drawing. 2) In this LISP, set a variable to the Blackboard namespace via (vl-bb-set), alternatively, you could set a value in the registry or a temporary text file. 3) Add a portion to the startup code in "acaddoc.lsp" to check the value of the variable using (vl-bb-ref), and if set, perform the (vla-ZoomExtents). 4) clear the variable previously set with (vl-bb-set) again to set the value to nil.1 point
-
Maybe Tharwat was referring to this code... Please help me create a lisp to Change color of dimension - AutoLISP, Visual LISP & DCL - AutoCAD Forums1 point
-
Dear @Saxlle, @Steven P thank You for Your answers and discusison. I think that code send by @Steven P Is what I was looking for. I've tried to implement 'solutions' from Excel into my script but there are much simpler and effective techniques I was not aware of. Thank You again for the answers Marcin1 point
-
Yes, you're right, agree. The only problem can be if you have the same "index", like: (setq MyList (list '(10 26509533.29 26509533.29 100.0) '(11 26509533.29 26509533.29 100.0) '(20 9985631.7 9985631.7 100.0) '(21 9985631.7 9985631.7 100.0) ;; same index value "21" '(30 6266660.57 6266660.57 20.0) '(21 9985631.7 9985631.7 100.0) ;; same index value "21" ) ; end list ) I haven't gone into depth on every possible problem, but it will work as expected.1 point
-
Hey @Rakesh H M, Try this: ; **************************************************************************************** ; Functions : RETAGS ; Description : Reorder TAG names with appropriate text values and layer names ; Author : SAXLLE ; Date : April 07, 2025 ; **************************************************************************************** (prompt "\nTo run a LISP type: RETAGS") (princ) (defun c:RETAGS ( / old_nomutt lst_tags_valid lst_layer_names ss len i lst_attribs tag_val tag_val_lst tag_val_lst_final data tag val n j new_lst1 new_lst2 subst_lst) (setq old_nomutt (getvar 'nomutt)) (setvar 'nomutt 1) (setq lst_tags_valid (list "UNIT#" "OPTSTYLE" "OPTSUFFIX" "SELFPRICE" "ZZPART" "ZZDETAIL" "ROOM" "FLOOR" "BUILDING" "PHASE" "KEYING" "ASSOCIATED" "HEIGHT" "DEPTH" "LENGTH" "ARCHNO" "LINE" "DEALER") ;; Valid order of the TAGS names lst_layer_names (list "ATT_UNITNO" "ATT_OPTSTYLE" "ATT_OPTSUFFIX" "ATT_SELFPRICE" "ATT_ZZPART" "ATT_ZZDETAIL" "ATT_ROOMNUMBER" "ATT_FLOOR" "ATT_BUILDING" "ATT_PHASE" "ATT_KEYING" "ATT_ASSOCIATED" "ATT_HEIGHT" "ATT_DEPTH" "ATT_LENGTH" "ATT_ARCHNO" "ATT_LINE" "ATT_DEALER") ;; Valid list of layer names ) (princ "\nSelect the BLOCK's to reorder TAGS names:") (setq ss (ssget '((0 . "INSERT"))) len (sslength ss) i 0 ) (while (< i len) (setq lst_attribs (list) tag_val (list) tag_val_lst (list) tag_val_lst_final (list) ) (setq data (entget (ssname ss i))) (while (not (equal (cdr (assoc 0 data)) "SEQEND")) (if (equal (cdr (assoc 0 data)) "ATTRIB") (progn (setq lst_attribs (cons data lst_attribs)) (setq data (entget (entnext (cdr (assoc -1 data))))) ) (setq data (entget (entnext (cdr (assoc -1 data))))) ) ) (foreach n lst_attribs (setq tag (cdr (assoc 2 n)) val (cdr (assoc 1 n)) tag_val (list tag val) tag_val_lst (cons tag_val tag_val_lst) ) ) (setq n 0) (while (< n (length lst_attribs)) (if (equal (nth n lst_tags_valid) (car (nth n tag_val_lst))) (setq tag_val_lst_final (cons (nth n tag_val_lst) tag_val_lst_final)) (progn (setq k 0) (while (not (equal (nth n lst_tags_valid) (car (nth k tag_val_lst)))) (setq k (1+ k)) ) (setq tag_val_lst_final (cons (nth k tag_val_lst) tag_val_lst_final)) ) ) (setq n (1+ n)) ) (setq tag_val_lst_final (reverse tag_val_lst_final) j 0 lst_attribs (reverse lst_attribs) new_lst1 (list) ;; List of TAGS new_lst2 (list) ;; List of text values ) ;; Reorder TAGS (repeat (length lst_attribs) (setq subst_lst (entmod (subst (cons 2 (car (nth j tag_val_lst_final))) (cons 2 (cdr (assoc 2 (nth j lst_attribs)))) (nth j lst_attribs)))) (setq new_lst1 (cons subst_lst new_lst1)) (setq j (1+ j)) ) (setq new_lst1 (reverse new_lst1) j 0) ;; Put the right text value into the Reorder TAGS (repeat (length lst_attribs) (setq subst_lst (entmod (subst (cons 1 (cadr (nth j tag_val_lst_final))) (cons 1 (cdr (assoc 1 (nth j new_lst1)))) (nth j new_lst1)))) (setq new_lst2 (cons subst_lst new_lst2)) (setq j (1+ j)) ) (setq j 0) (setq new_lst2 (reverse new_lst2)) ;; Substitue layer names (repeat (length lst_attribs) (entmod (subst (cons 8 (nth j lst_layer_names)) (cons 8 (cdr (assoc 8 (nth j new_lst2)))) (nth j new_lst2))) (setq j (1+ j)) ) (setq i (1+ i)) ) (setvar 'nomutt old_nomutt) (prompt (strcat "\nThe " (itoa i) " BLOCK's with attribute TAGS has been reorder!")) (princ) ) I tested it on your an example drawing (just on few blocks), and it works. See attached picture. I hope it will be helpful. P.S. I agree with what @BIGAL was mention. Best regards. Notice: not fully tested, maybe some unexpected occurrence can happen. NOT YET VALID AS ACCEPTABLE SOLUTION!!!1 point
-
Have you thought about using a script, it can open a new dwg and will automatically then be in that dwg. Script code. (command "New" "Yourtemplatename") (alert "now in other dwg do your lisp code here") version 2 (command "New" "Yourtemplatename") (load "your lisp program")1 point
-
Not a lot you can do, if the project time and budget allows we can always create a DWG from any supplied data, PDFs included. You could make it a hassle to convert, use anything apart from true type fonts might get converted as lines. Explode dashed lines, centre etc to individual parts. Explode all blocks, polylines, texts, mtexts, delete hatch boundaries, offset all lines a very small amount in any direction, flatten the drawing to layer 0, set a few random entities at a Z value other than where they should be, convert arcs, circles, polyline bulges to straight line equivalents, Insert specific drawing styles, names and so on that identify you as the drawing owner (sheep as a full stop are my favourite). You could convert such a PDF back to CAD but make it very tricky to work with. A these steps can be automated if necessary, remember don't save the drawing once it is messed up. How far you want to annoy anyone wanting to convert the PDF is up to you, all you are doing is slowing down the conversion, maybe to an extent that it isn't worth it. It can always be converted back though.... even if it is redrawn 99%1 point
-
plot your file to Image using PublishToWeb plotter. Convert the Image to PDF1 point
-
There are a few threads around here on this topic. Basically, you can't 100%, as it can still be traced and or duplicated from the dimensions if there are any, etc., best way is to make it as hard as possible. A well worded contract on not reusing your information will go along way to prevent conversion/reuse, just get legal services on specifics. Preventing our PDFs From Being Imported into Acad as Autocad Entities? - AutoCAD Drawing Management & Output - AutoCAD Forums PDF/ JPG file conversion threat. - AutoCAD 2D Drafting, Object Properties & Interface - AutoCAD Forums1 point
-
If you can create the layouts from your LISP but just need to adjust the rectangular view this might be a 'fix', will only really work for orthogonal rectangles. Double click in the view port, run this LISP, select the rectangle area to be shown in that view port. ;;https://forums.autodesk.com/t5/autocad-forum/having-trouble-with-the-lisp-that-zooms-a-rectangle-that-fits-in/td-p/9378532 (defun c:zvprect ( / a b e o) ;; I renamed this to fit my brain: 'z' - zoom, 'vp' - viewport, 'rect' - rectangle (if (setq e (car (entsel "\nSelect Rectangle : "))) (progn (setq o (vlax-ename->vla-object e)) (vlax-invoke-method o 'GetBoundingBox 'a 'b) (setq a (vlax-safearray->list a) b (vlax-safearray->list b) ) (vl-cmdf "_.zoom" a b) ) ) (princ) )1 point