Jump to content

All Activity

This stream auto-updates

  1. Today
  2. Had this laying around sounds like what you want to do. used it mostly on circles but will work on any entity. it calculates the mid point so might want to replace line 8 - 11 with just a getpoint. COB.lsp
  3. mhupp

    editing a macro

    How big is your printer? Sound like you have PSLTSCALE turned off.
  4. Glad you got it working, a good idea is post code so we my help improve it.
  5. I use Notepad++ and it has a plugin for ActiveX which allows you to run the lisp code in Autocad, whilst testing etc. You can set language to lisp so it does color changing of the code as well as bracket checking. I use Bricscad now so the Active X stopped working so I often use Cut and paste to command line. But I have been programming for like 40 years so understand how to do that.
  6. It is probably best to post some sort of sample dwg so we can see what it is your trying to do.
  7. Yesterday
  8. "With the calculation of weight, it becomes more complicated." Fields can have formulas so you can get area and * weight.
  9. BIGAL

    text and mtext

    Possible 2 problems you can not use a variable name of "t" this is interpreted as the system variable TRUE, use say Tval. The other is Mtext may be a better way to go. (command "_mtext" p13 p13 (strcat "RISER " (rtos rh 2 3) "\n" "TREAD " (rtos tval 2 3)))
  10. i ran it on this tiny drawing and didnt seem to work properly.. OVERLAPPING LINES.dwg
  11. Added the command line to zoom scXP and it worked ! Was not able to use a variable for the zoom command so used if-statements to enter the text needed for each scale.
  12. Hello If you want to program in lisp it is better to do it from the Visual Lisp IDE. To open it, simply write on the command line: vlide And press ENTER
  13. Jared A

    editing a macro

    when on the layout page, we set the scale back to 1:1 with nothing selected so that the x-referenced drawings will show correctly, i.e. dashed lines, hatching, etc. this does not change the scale of the viewports which are sometimes set to 1/4 or 1/8 scale. on our shortcut commands it says "setup 1:1", not sure if that helps.
  14. I am currently learning AutoLISP programming. I am using Notepad but would like to switch to Visual Studio Code or Notepad++. I tried to find tutorial videos on YouTube but couldn’t find any. I have installed Visual Studio Code with the AutoLISP extension and Notepad++, but I am still struggling to run any programs. Can anyone please explain how to use these code editors for AutoLISP programming or provide links to tutorial videos on YouTube?
  15. Steven P

    editing a macro

    OK, which scale did you mean?
  16. I had not thought of that and will keep it in mind if the problem persists however, it seems to have resolved itself after re-attaching it today. I suspect its a buggy drawing. Thank you for the lead, I'll be checking this in the future as well!
  17. We just re-opened the main drawing to check this (thank you for the suggestion, I didn't know about this) and this misbehaving utility drawing was attached but not showing at all, layers thawed and unfrozen and zoomed extents an everything... After checking INSBASE in the main and util drawing we reattached it and it came in fine. I suspect its just a buggy drawing. Thank you again, I will be checking this variable from now on.
  18. Jared A

    editing a macro

    I see the viewport scale set to 1:1. My mistake, I should have clarified that I want to set the overall sheet scale to 1:1 and not change the viewports. Thanks for the info. I will work with what you have shown.
  19. Steven P

    editing a macro

    Copied and pasted from my Lisp Library: The first are useful functions to have to hand. For example "ZA" - Zoom All I use all the time in preference to "Zoom" "All" "Closer" closes document, no save "VPScale" sets all viewports to 1:1 scale in that sheet Put together in MyClose at the end. Load them all up and it should be OK ;;;;SubFunctions, Useful to have anyway;;;; ;;;;Zooms: ZE - extents, ZA - All, ZO - Object, ZP - Previous (defun c:ze() ;;Zooms extents, then zooms out 0.95x (command "zoom" "e" "zoom" ".95x")(princ) ) (defun c:za() ;;Zoom all, then zooms out 0.95x (command "zoom" "a" "zoom" ".95x")(princ) ) (defun c:zo() ;;Zoom object (command "zoom" "o" "zoom" "0.95x")(princ) ) (defun c:zp() ;;Zoom previous (command "zoom" "p")(princ) ) ;;;;asave: Save Lisp (defun c:asave( / currentversion saveasversion old) (setq vars '("CMDECHO" "FILEDIA")) ;;Disable command promts and echo vars (setq old (mapcar 'getvar vars)) ;;Record current vars (mapcar 'setvar vars '(0 0)) ;; Change vars (if (= 1 (getvar "dwgtitled"))(command "qsave")) ;; EXISTING DRAWING (if (= 0 (getvar "dwgtitled")) (COMMAND "_.saveas" "" "~") ) ;;new drawing (mapcar 'setvar vars old) ;;reset command prompt and echo (princ) ) ;;;;closer: Closes drawing, no save (defun c:closer( / *doc* opendrawings) (if (= dbmod 0)(command ".close")) ;; Close if drawing is saved (if (/= dbmod 0)(command ".close" "y")) ;; Close if drawing is not saved ) ;;;; VPScale: Sets all viewports in sheet to 1:1 (defun c:VPScale ( / MySS scale acount) (setq MySS (ssget "_X" '((0 . "VIEWPORT")))) ;; Select all viewports (setq acount 0) ;; A counter (setq scale 1) ;;1 = 1:1 ;; Scale to use (while (< acount (sslength MySS)) ;; loop through selection set (vla-put-customscale (vlax-ename->vla-object (ssname MySS acount)) scale) ;; Set viewports scales (setq acount (+ acount 1)) ) ; end while ) ;;;;; End sub routines ;;;;; ;;;;Zoom extents, all viewports to 1:1, save, close (defun C:MyClose ( / LayList CurrentLay Lay) (setq LayList (layoutlist)) ;; Get layout List (ACAD 2023+) (setq CurrentLay (getvar "ctab")) ;; Record current layout (foreach Lay LayList ;; Loop through each layout (setvar "ctab" Lay) ;; Change layout (c:ZE) ;; Run ZE: Zoom Extents (above) (c:vpscale) ;; Run VPScale, set all viewports to 1:1 ) ; end foreach ;; End loop (setvar "ctab" CurrentLay) ;; Return to previous sheet (c:asave) ;; Save (c:closer) ;; Close )
  20. You need just to work on the formatting of the Mtext to get it the way you want it.
  21. GLAVCVS

    Enable osnap in LM:GrText program

    I'm glad to know that it is useful to you.
  22. Everything is perfect now! It wasn't that easy! Thank you many times!
  23. I edited something at the last minute. You may need to copy the code again
  24. Something else needs to be changed so that other texts have their own layer...
  25. (defun c:hatcharea-GL1 (/ ss area i eo pt lst layer lstLayers color) (setq ss (ssget '((0 . "hatch"))) area 0 i 0 ) (cond ((and (and ss) (> (sslength ss) 0)) (repeat (sslength ss) (setq eo (vlax-ename->vla-object (ssname ss i))) (setq area (vlax-get eo 'Area) layer (vlax-get-property eo "LAYER") ) (if (setq lst (assoc layer lstLayers)) (setq lstLayers (subst (list layer (+ (cadr lst) area)) lst lstLayers ) ) (setq lstLayers (append lstLayers (list (list layer area)))) ) (setq i (+ i 1)) ) (if (= (setq color (vlax-get-property eo "COLOR")) 256) (setq color nil) ) (foreach layer lstLayers (if (setq pt (getpoint (strcat "\nInsertion point for area HATCHs in layer \'" (strcase (car layer)) "\'" ) ) ) (progn (setq area (cadr layer)) (setvar "CECOLOR" "BYLAYER") (command "_.STYLE" "Standard" "" 2 "" "" "" "") (command "_.text" pt 0 (strcat "Area = " (rtos area 2 2)) "" ) (command "_.STYLE" "Standard" "" 0.2 "" "" "" "") (vla-put-layer (vlax-ename->vla-object (entlast)) (car layer)) (if color (vla-put-color (vlax-ename->vla-object (entlast)) color) ) ) ) ) ) ) (princ) )
  26. Hi, can anyone help me to create a lisp with the following requirement: I will copy any object with basepoint (lets say a circle, copy with basepoint at center), then paste it at the insertion point of selected blocks. or simply to say, paste object multiple times in insertion point of selected blocks (or to any object that has insertion snap)
  27. error: no function definition: VLAX-PUT-LAYER
  1. Load more activity
×
×
  • Create New...