Jump to content

All Activity

This stream auto-updates

  1. Past hour
  2. BIGAL

    Field

    Another By @Lee Mac Area.lsp look on his web site. https://www.lee-mac.com/arealabel.html
  3. Lee Mac

    LISP Assistance

    Have you defined the variables 'myfilepath' and 'myfilename' somewhere? If not, these symbols will evaluate to nil, yielding the error you have described.
  4. The answers you seek can be found in the thread entitled... "Penn Foster Student Suffering with Oleson Village Map." I know this because I contributed instructions as well as images. Many P-F students have found the thread beneficial.
  5. Today
  6. GLAVCVS

    LISP Assistance

    Hi It's not certain that all the functions in this code will work in AutoCAD LT. Try it. (defun c:guardA (/ v nvoD f?) (setq v (member (vla-get-saveAsType (vla-get-openSave (vla-get-preferences (vlax-get-acad-object)))) (list acr14_dwg "v14" ac2000_dwg "v2000" ac2004_dwg "v2004" ac2007_dwg "v2007" ac2010_dwg "v2010" ac2013_dwg "v2013" ac2018_dwg "v2018"))) (setq f? (if (not (vl-directory-files (setq nvoD (strcat (getvar "DWGPREFIX") "EXPORTED\\")))) (VL-MKDIR nvoD) T)) (vla-saveas (vla-get-activedocument (vlax-get-acad-object)) (strcat (if f? nvoD (getvar "DWGPREFIX")) (VL-FILENAME-BASE (getvar "DWGNAME")) "-EXPORTED_" (cadr v) ".dwg") (car v)) (princ "\nDone!") (princ) )
  7. Thanks, I found this lisp that works for me. If anyone is interested here is the link. Visibility Selection
  8. Steven P

    LISP Assistance

    LT is not brilliant with VLA- or VL- commands so best really avoid them for now. Perhaps not the most efficient method but try the (command "_.saveas" ...... ) method
  9. Steven P

    Field

    ... have you tested that...
  10. Nikon

    subfix in dimension...

    Here are two good options from Lee Mac
  11. swanny89

    LISP Assistance

    Hi all, I've been trying to accomplish what I thought would be an easy thing, but despite hours of searching I can't seem to get it to work! I'm trying to create a lisp that I can run in AutoCAD LT (2025) that does a "SAVE AS" and simply adds " - EXPORTED" as a suffix onto the original filename. I'd like this to happen without any dialogue boxes popping up, and If it could have the following features it would be absolutley perfect (but these arent crucial). 1. specify the file version from within the lisp 2. save the exported versions into a folder within the same directory called "exported" (and overwrite previous versions if they exist) The closest I've gotten is using the below code to do the saveas, but it throws an error (; error: bad argument type: stringp nil) (defun c:TEST () (vl-load-com) (vla-SaveAs (vla-get-ActiveDocument (vlax-get-acad-object)) (strcat myfilepath myfilename ".dwg") ac2018_dwg) ) If anyone is able to help me out I'd very much appreciate it
  12. Koz

    Field

    Another simple way is to entmake the mtext with a plain content first, then apply entmod DXF1 with field expression for the mtext.
  13. Lee Mac

    Field

    You're welcome!
  14. Are you using AutoCAD 2010 as shown in your profile? I do not believe this is an issue in newer AutoCAD versions, I am not sure what version it was fixed though. UPDATE: From the posted thread, looks like AutoCAD 17.1 update or maybe AutoCAD 2018 had the fix. AutoCAD 2023 Help | SELECTIONOFFSCREEN (System Variable) | Autodesk You'll probably need to keep searching and see what workarounds people came up with before the fix. Losing selected objects when zooming/panning etc - AutoCAD 2D Drafting, Object Properties & Interface - AutoCAD Forums Solved: AutoCAD - Zoom after selection lost object selected - Autodesk Community
  15. That LISP the is not original AFAIK. It is a couple of functions, you need to call for it with a LISP to make the settings, etc. Several places to get the correct QlSet.lsp and example LISPs to use it. Qleader lisp routine - AutoLISP, Visual LISP & DCL - AutoCAD Forums Qleader System Variables - AutoLISP, Visual LISP & DCL - AutoCAD Forums qleader lisp - AutoLISP, Visual LISP & DCL - AutoCAD Forums assigning q-leader settings using lisp
  16. maahee

    Field

    ;;;;;;;;;;;;;;;;;;;;;;;;;;; (setq mtext (vla-AddMText mspace (vlax-3d-point pt) 0.0 ; width (0 for default) (strcat "%<\\AcObjProp.16.2 Object(%<\\_ObjId " (itoa (vla-get-ObjectID entity)) ">%).Area \\f \"%lu2%pr2%ps\">%") ) ) ;; Set properties (vla-put-Layer mtext "mtext") (vla-put-Height mtext 0.3) (vla-put-AttachmentPoint mtext 5) ; Middle-center (vla-put-InsertionPoint mtext (vlax-3d-point pt)) (vla-put-StyleName mtext "Standard") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; I am replacing entmakex with vla-addmtext and have completed the task. I want to apply various text properties, such as bold, underline, color, style, height, etc.............................thank...........................
  17. Have a look at lee-mac dynamic block properties there is a get current visibility name in there, also get all visibility names into a list.
  18. Look at (getvar 'extmax) & (getvar 'extmin) these are the size of your dwg wether your zoomed or not.
  19. BIGAL

    subfix in dimension...

    Something I have done for attributes in a block is pop up a dcl with the current attribute values so there is no reason why could not do the same just set a maximum number of lines 1 2 3 4 etc. If you leave a line blank that would be considered end of multi line input. It uses my library Multi getvals.lsp to make the dcl. Some example code can be changed to work with a Dimension. Have a go. ; Change an attribute value in blocks ; Using creation order rather than by tag name ; BY Alan H Sept 2025 (defun AH:blchange( / ss1 blname x inc atts) (if (not AH:getvalsm)(load "Multi Getvals.lsp")) (setq obj (vlax-ename->vla-object (car (entsel "\nPick block object ")))) (setq atts (vlax-invoke obj 'Getattributes)) (setq lst '()) (setq lst '("Enter new values ")) (foreach att atts (setq lst (cons (vlax-get att 'tagstring) lst)) (setq lst (cons 19 lst)) (setq lst (cons 20 lst)) (setq lst (cons (vlax-get att 'Textstring) lst)) ) (setq lst (reverse lst)) (setq ans (AH:getvalsm lst)) (setq x -1) (foreach att atts (vlax-put att 'Textstring (nth (setq x (1+ x)) ans)) ) (princ) ) (aH:blchange) Multi GETVALS.lsp
  20. BIGAL

    Find in Notepad

    Look for Notepad your Acad.pgp make code even shorter. This the bat file I use. d: cd\alan\lisp findstr %1 *.lsp
  21. You can private message me if you are after a custom program.
  22. 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
  23. (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!
  24. Yesterday
  25. 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
  26. GLAVCVS

    subfix in dimension...

    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.
  27. leonucadomi

    subfix in dimension...

    @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
  28. @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?
  1. Load more activity
×
×
  • Create New...