Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/24/2022 in all areas

  1. After some experimenting, I got there: (steal (findfile "StealTest.dwg") (list (list "Multileader Styles" (list imp)))) Sensational piece of kit, Lee!
    3 points
  2. Example macro from the first location that sets you new drawing current once it's added: ^C^C^P(vla-activate (vla-Add (vla-get-Documents (vlax-get-acad-object)) (strcat "S:" (chr 92) "template" (chr 92) "Titleblocks" (chr 92) "Facilities A Model.dwt"))) Entering the same thing at the command line without ^C^C^P part does the same thing. (vla-activate (vla-Add (vla-get-Documents (vlax-get-acad-object)) (strcat "S:" (chr 92) "template" (chr 92) "Titleblocks" (chr 92) "Facilities A Model.dwt"))) Like Tharwat said it's simpler if you add your Template into the default Template folder: ^C^C^P(vla-activate (vla-Add (vla-get-Documents (vlax-get-acad-object)) "Facilities A Model.dwt")))
    1 point
  3. You need to keep the name of the template the same or change it to the ones that are available in your AutoCAD and you can explore that once you invoke the new or qnew command. You did miss one close bracket at the end of your example.
    1 point
  4. Are you looking to do this with LISP?
    1 point
  5. 1 point
  6. Because they started at the ROW and not at 0+00.
    1 point
  7. Is it just 1 closed polyline on Layer-1, and 1 on Layer -2? Can there be overlap, or is 2 nicely within 1? (no overlap would make it easier) Anyway, see if you're happy with this (vl-load-com) (defun drawM-Text (pt str) (entmakex (list (cons 0 "MTEXT") (cons 100 "AcDbEntity") (cons 100 "AcDbMText") (cons 10 pt) (cons 1 str)))) ;; ADC, for Area Deducting Cutout (defun c:adc ( / ss l1 l2 i ent lay area1 area2 area3 txt txtobj) ;; Step-1: After entering command user will select whole drawing in single selection (princ "\nSelect all objects: ") (setq ss (ssget (list (cons 0 "POLYLINE,LWPOLYLINE")))) ;; Step-2: Lisp will select only object in Layer-1 & Layer-2 (Other layers objects will be ignored) (setq i 0) (repeat (sslength ss) (setq ent (ssname ss i)) ;; read layer (setq lay (cdr (assoc 8 (entget ent)))) (princ "\n") (princ lay) ;; Step-3: Lisp will calculated the area of Layer-1 & Layer-2 (if (= "Layer-1" lay) (progn (setq area1 (vla-get-area (vlax-ename->vla-object ent))) (princ " - area: ") (princ area1) ) ) (if (= "Layer-2" lay) (progn (setq area2 (vla-get-area (vlax-ename->vla-object ent))) (princ " - area: ") (princ area2) ) ) (setq i (+ i 1)) ) ;; Step-4: Now it will Subtract the area of Layer-2 from Layer-1 (setq area3 (- area1 area2)) ;; Step-5: and paste it as Text. (setq txt (strcat "Total Area: " (rtos area1 2 2) "\nCutout Area: " (rtos area2 2 2) "\nSubtracted Area: " (rtos area3 2 2) ) ) (drawM-Text (getpoint "\nPick a point to put the MText: ") txt) (princ) )
    1 point
  8. Written for fun and practice - a windows form project (the .rar contains the .exe file of the program). Now you don't have to need to run ACAD for just to strip the code with LISP. EDIT: Updated the program (included a vertical bar, so one could scroll through the code) - I've forgot that they can get quite lengthy Also modified a bit the default regex pattern, so it would strip also patterns like [color=#87d6ee] or ( previous pattern was looking just for ) ForumCodeTags.rar
    1 point
×
×
  • Create New...