Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/03/2021 in all areas

  1. Version 1.7.0

    3,315 downloads

    This program will calculate the total length of Lines/Polylines/LWPolylines/Arcs/Ellipses/Circles/Splines with an optional filter. The Filter may be used to select only those lines that are on a certain layer, or perhaps have a certain linetype or colour. The results of the calculation can be displayed in an ACAD Table within the drawing, or written to either a CSV or TXT File. The Table-Style may be selected from the drop-down in the main dialog. Main interface The main dialogue box allows the user to filter lines by layer, linetype or colour and select the table style. Multiple selected items can filtered. A filter string may be entered to help the user quickly find the filter items that he/she requires. Options The options dialogue box allows the user to specify which object types should be included and the type of output, table in the drawing, CSV file or TXT file. Demo Function Syntax: LenCal For instructions on how to run the program see here. Any comments, criticism and suggestions are welcome. Either PM me directly, or reply to the original thread.
    1 point
  2. I didn't notice the flip action behaving that way, it could be a version issue. neat block, and really neat method, looks like I have to read up on this, and practice, I can see this in my future.
    1 point
  3. Steven, I don't know if you have access to The Swamp, but Marko Ribar created a routine which might work for you. It is similar to the Blockify command in Bricscad, where you can make blocks from similarly arranged entities (in your case lines which form letters), I can't test it as I am already using Bricscad so have no need for it but it may help you select the "letters". http://www.theswamp.org/index.php?topic=55186.0
    1 point
  4. Looking good up to now. Yes it is a lot of work for something like this, but unfortunately that is the nature of the beast. Working with parameters and actions is a manual task, yes you can copy/paste data into individual rows in a lookup but not with ranges, so it doesn't really help much. The people over in the 'Lisp' area of the Forums might be able to help you with that!
    1 point
  5. Yeah it's really sometimes just a matter of troubleshooting, testing, troubleshooting, testing, etc.. until you get it where u want. Dynamic blocks are a great way to learn how autocad treats blocks in general though. The concept is very similar to how other autodesk features work.
    1 point
  6. It seems to work fine for me. Stretches as far out as I need. I have a feeling you may have a snap setting on that is interfering with the stretch function. Turn off snap and leave osnap on would be my first thing to check then try again. Some people when they make a new block they use the wrong DWG or DWT template when they start and it can throw off your settings you would normally have. -ChriS
    1 point
  7. Welcome and thanks for sharing. I read your description and I think it might do the same as the code below. ; https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-change-color-of-dimensions-with-text-override/m-p/5103678/highlight/true#M323552 (defun c:dimover ( / ent i ss txt) (if (setq ss (ssget "_X" '((0 . "DIMENSION")))) (repeat (setq i (sslength ss)) (setq ent (entget (ssname ss (setq i (1- i)))) txt (cdr (assoc 1 ent)) ) (if (not (or (= txt "") (wcmatch txt "*<>*"))) (if (assoc 62 ent) (entmod (subst (cons 62 2) (assoc 62 ent) ent)) ;; change the color 2 if needed (entmod (append ent (list (cons 62 2)))) ;; change the color 2 if needed ) ) ) ) (princ) )
    1 point
  8. (defun c:YourCommand () (command "_.-layer" "_lw" "default" "*" "") (princ) ) (defun c:YourCommand () (vlax-for l (vla-get-layers (vla-get-activedocument (vlax-get-acad-object))) (vla-put-lineweight l aclnwtbylwdefault)) (princ) ) I'm sure you could have worked this out
    1 point
  9. Here is another (faster) way to approach it using ObjectDBX. This code will process all drawings in a directory (and subdirectories): (defun c:Test ( / layString ) (setq layString "#") (Mac-ODBX (function (lambda ( x ) (vlax-for lay (vla-get-layers x) (if (wcmatch (vla-get-name lay) layString) (vl-catch-all-apply (function vla-put-freeze) (list lay :vlax-true) ) ) ) ) ) nil t ) (princ) ) ;;;¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,;;; ;;;ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,¤º°`°º¤;;; ;; ;; ;; ;; ;; --=={ ObjectDBX Base Program }==-- ;; ;; ;; ;; Provides a shell through which a LISP may operate on multiple drawings in a ;; ;; folder/sub-folders. ;; ;; ;; ;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=;; ;; ;; ;; AUTHOR: ;; ;; ;; ;; Copyright © Lee McDonnell, January 2010. All Rights Reserved. ;; ;; ;; ;; { Contact: Lee Mac @ TheSwamp.org, CADTutor.net } ;; ;; ;; ;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=;; ;; ;; ;; ARGUMENTS: ;; ;; ;; ;; foo ~ a function taking a single argument (the Document Object), and ;; ;; following the 'rules' of ObjectDBX: ;; ;; ;; ;; - No SelectionSets (ssget,ssname etc.) ;; ;; - No Command calls ;; ;; - No *Ent Methods (entget,entmod etc.) ;; ;; - No Access to System Variables (vla-Set/GetVariable, etc) ;; ;; ;; ;; dwgLst ~ [Optional] A list of dwg filepaths to process, if nil, program ;; ;; will display BrowseForFolder dialog. ;; ;; ;; ;; save ~ [boole] if True, drawing will be saved after function evaluation. ;; ;; ;; ;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=;; ;; ;; ;;;¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,;;; ;;;ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,¤º°`°º¤;;; (defun Mac-ODBX (foo dwgLst save / *error* ObjRelease Get_Subs DirDialog ObjectDBXDocument DBX DBXDOC DOCLST DWGLST ERR FILE FILEPATH FLAG FOLDER PATH RESULT SUBS) (vl-load-com) (setq *acad (cond (*acad) ((vlax-get-acad-object))) *adoc (cond (*adoc) ((vla-get-ActiveDocument *acad)))) ;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=;; (defun *error* (msg) (ObjRelease (list dbx dbxdoc)) (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*") (princ (strcat "\n** Error: " msg " **"))) (princ) ) ;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=;; (defun ObjRelease (lst) (mapcar (function (lambda (x) (if (and (eq (type x) 'VLA-OBJECT) (not (vlax-object-released-p x))) (vl-catch-all-apply (function vlax-release-object) (list x) ) ) ) ) lst ) ) ;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=;; (defun Get_Subs (folder / file) ;; CAB (mapcar (function (lambda (x) (setq file (strcat folder "\\" x)) (cons file (apply (function append) (get_subs file))) ) ) (cddr (vl-directory-files folder nil -1)) ) ) ;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=;; (defun DirDialog (msg dir flag / Shell Fold Path) ; Lee Mac ~ 07.06.09 (setq *acad (cond (*acad) ((vlax-get-acad-object)))) (setq Shell (vla-getInterfaceObject *acad "Shell.Application") Fold (vlax-invoke-method Shell 'BrowseForFolder (vla-get-HWND *acad) msg flag dir)) (vlax-release-object Shell) (if Fold (progn (setq Path (vlax-get-property (vlax-get-property Fold 'Self) 'Path ) ) (vlax-release-object Fold) (and (= "\\" (substr Path (strlen Path))) (setq Path (substr Path 1 (1- (strlen Path)))) ) ) ) Path ) ;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=;; (defun ObjectDBXDocument (/ acVer) (setq *acad (cond (*acad) ((vlax-get-acad-object)))) (vla-GetInterfaceObject *acad (if (< (setq acVer (atoi (getvar "ACADVER"))) 16) "ObjectDBX.AxDbDocument" (strcat "ObjectDBX.AxDbDocument." (itoa acVer)) ) ) ) ;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=;; (if (setq dwgLst (cond (dwgLst) ( (setq Path (DirDialog "Select Directory to Process" nil 0)) (initget "Yes No") (setq subs (cond ((getkword "\nProcess SubDirectories? <Yes> : ")) ("Yes"))) (apply (function append) (vl-remove 'nil (mapcar (function (lambda (Filepath) (mapcar (function (lambda (Filename) (strcat Filepath "\\" Filename) ) ) (vl-directory-files Filepath "*.dwg" 1) ) ) ) (append (list Path) (apply (function append) (if (= "Yes" subs) (Get_Subs Path)) ) ) ) ) ) ) ) ) (progn (vlax-for doc (vla-get-Documents *acad) (setq DocLst (cons (cons (strcase (vla-get-fullname doc)) doc ) DocLst ) ) ) (setq dbxdoc (ObjectDBXDocument)) (foreach dwg dwgLst (setq flag (and (setq dbx (cdr (assoc (strcase dwg) DocLst) ) ) ) ) (and (not flag) (setq Err (vl-catch-all-apply (function vla-open) (list dbxdoc dwg)) dbx dbxdoc)) (if (or flag (not (vl-catch-all-error-p Err))) (progn (setq Result (cons (cons dwg ((eval foo) dbx)) Result ) ) (if save (vla-saveas dbx dwg)) ) (princ (strcat "\n** Error Opening File: " (vl-filename-base dwg) ".dwg **")) ) ) ) ) (ObjRelease (list dbx dbxdoc)) Result ) The highlighted part should be a WildCard string specifying the layers you wish to freeze. The drawback of using ObjectDBX is that you will lose the drawing thumbnail until you next save the drawing manually. Type 'test' to invoke the function. If you have any trouble with it, let me know, Lee
    1 point
×
×
  • Create New...