Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/09/2025 in all areas

  1. Is the (arxload "acetutil.arx") working in your image ARXLOAD failed, you may need a full path use "\\" between directories. Just find acetutil.arx with explorer. Look Program files\Autodesk. Accoreconsole may not support acet functions. It does have limitations. If you can not get past the load will need to use maybe OBDX or an old fashioned script. Make sure with all testing you use a dummy directory of copied files.
    2 points
  2. Nice! This should speed up your process considerably!
    1 point
  3. @Engineer_Yasser Some of your linework is not drawn as tight as your first example. Look at the start point of this polyline in relation to your block insertion point. To 'fix' my code up the variable 'fz' to something like 2. In the scenario where the block is located on an end does it still pick a route since they are both on the same side? I'm curious, what are these drawings used for? Test 2-FZ=2.dwg
    1 point
  4. Thanks all for your suggestions, and yes i have been testing on a dummy directory . I've decided to abandon the laytrans route, instead will use a script that renames and updates any other parts of the layer instead - as I'm typing this it is running in the background updating 100files as a test, I think i was trying to be too clever before and when i only have very basic knowledge of lisp creation i was biting off more than i could chew. off to refine the new routine and add more functions to it just because...
    1 point
  5. You're welcome. I'm glad it helped.
    1 point
  6. The error occured because the "layer name" of the "blll" block was changed into "HH Block" (old "layer name" was "BLK"), that is the reason. ;; OLD (setq ss (ssget "X" '((0 . "INSERT") (8 . "BLK") (2 . "blll"))) ;; NEW (setq ss (ssget "X" '((0 . "INSERT") (8 . "HH Block") (2 . "blll"))) Try this modified code: ; ************************************************************************ ; Functions : CHCOLPL ; Description : Change the colors of the Polylines into the yellow ; Author : SAXLLE ; Date : January 08, 2025 ; ************************************************************************ (prompt "\nTo run a LISP type: CHCOLPL") (princ) (defun c:CHCOLPL ( / ss len i ssn ename ent_pl data spt ept 2ndpt 3rdpt midpt lenn tlen k) (setq ss (ssget "X" '((0 . "INSERT") (8 . "HH Block") (2 . "blll"))) len (sslength ss) i 0 ) (while (< i len) (setq ssn nil) (setq ename (ssname ss i)) (command-s "_explode" ename "") (setq ent_pl (ssget "x" '((0 . "LWPOLYLINE") (8 . "BLK") (62 . 1) (70 . 1))) data (entget (ssname ent_pl 0)) spt (cdr (nth 15 data)) 2ndpt (cdr (nth 20 data)) 3rdpt (cdr (nth 25 data)) ept (cdr (nth 30 data)) midpt (polar spt (angle spt ept) (/ (distance spt ept) 2)) ) (command-s "_undo" 1 "") (setq ssn (ssget "_F" (list spt ept) '((0 . "LWPOLYLINE") (8 . "Poly")))) (if (/= ssn nil) (progn (setq lenn (sslength ssn)) (if (= lenn 1) (setq k 0) (setq k 1) ) (setq tlen (vlax-get-property (vlax-ename->vla-object (ssname ssn 0)) 'Length)) (while (< k lenn) (if (< tlen (vlax-get-property (vlax-ename->vla-object (ssname ssn k)) 'Length)) (progn (setq tlen (vlax-get-property (vlax-ename->vla-object (ssname ssn k)) 'Length) sssn (ssname ssn k) ) ) (progn (setq sssn (ssname ssn k)) ) ) (setq k (1+ k)) ) (setq eptn (vlax-curve-getEndPoint (vlax-ename->vla-object sssn))) (if (> (cadr midpt) (cadr eptn)) (progn (setq ssn (ssget "_F" (list spt ept) '((0 . "LWPOLYLINE") (8 . "Poly")))) (command-s "_chprop" ssn "" "c" 2 "") ) (progn (setq ssn (ssget "_F" (list 2ndpt 3rdpt) '((0 . "LWPOLYLINE") (8 . "Poly")))) (if (/= ssn nil) (progn (setq lenn (sslength ssn)) (if (= lenn 1) (setq k 0) (setq k 1) ) (setq tlen (vlax-get-property (vlax-ename->vla-object (ssname ssn 0)) 'Length)) (while (< k lenn) (if (< tlen (vlax-get-property (vlax-ename->vla-object (ssname ssn k)) 'Length)) (progn (setq tlen (vlax-get-property (vlax-ename->vla-object (ssname ssn k)) 'Length) sssn (ssname ssn k) ) ) (progn (setq sssn (ssname ssn k)) ) ) (setq k (1+ k)) ) (setq midpt (polar 2ndpt (angle 2ndpt 3rdpt) (/ (distance 2ndpt 3rdpt) 2))) (setq eptn (vlax-curve-getEndPoint (vlax-ename->vla-object sssn))) (setq ssn (ssget "_F" (list midpt eptn) '((0 . "LWPOLYLINE") (8 . "Poly")))) (command-s "_chprop" ssn "" "c" 2 "") ) ) ) ) ) (progn (setq ssn (ssget "_F" (list 2ndpt 3rdpt) '((0 . "LWPOLYLINE") (8 . "Poly")))) (if (/= ssn nil) (progn (setq lenn (sslength ssn)) (if (= lenn 1) (setq k 0) (setq k 1) ) (setq tlen (vlax-get-property (vlax-ename->vla-object (ssname ssn 0)) 'Length)) (while (< k lenn) (if (< tlen (vlax-get-property (vlax-ename->vla-object (ssname ssn k)) 'Length)) (progn (setq tlen (vlax-get-property (vlax-ename->vla-object (ssname ssn k)) 'Length) sssn (ssname ssn k) ) ) (progn (setq sssn (ssname ssn k)) ) ) (setq k (1+ k)) ) (setq eptn (vlax-curve-getEndPoint (vlax-ename->vla-object sssn))) (setq midpt (polar 2ndpt (angle 2ndpt 3rdpt) (/ (distance 2ndpt 3rdpt) 2))) (setq eptn (vlax-curve-getEndPoint (vlax-ename->vla-object sssn))) (setq ssn (ssget "_F" (list midpt eptn) '((0 . "LWPOLYLINE") (8 . "Poly")))) (command-s "_chprop" ssn "" "c" 2 "") ) ) ) ) (setq i (1+ i)) ) (princ) ) After the test, i get this (see attached picture). The "white" color is sections which I made for testing, the "magenta" color present the polylines which are not changed, and the "red" color present the "one" polyline which are not starting from the "base point" of the "blll" block and the color was not changed into the "yellow". The "cyan" color present the position where the block "blll" is missing, and colors of the polylines didn't changed. Best regards.
    1 point
  7. @Wilkibob Normally you should be able to run command line lisp statements from a script file, but I don't know when it comes to BATCH (.bat) file. See if adding the code into the lisp file and loading it works? If not - then I don't think your going to be able to use a BATCH file anyway. You can always use a SCRIPT (.scr) file with a 2nd instance of AutoCAD open in the background. Add to ltrans.lsp: (arxload "acetutil.arx") (acet-laytrans "c:/users/joe.bloggs/Downloads/Steelwork.dws" 0) Then to script: (load "c:/users/joe.bloggs/Downloads/Laytrans.lsp") qsave close
    1 point
  8. You could try my post, October 5th linked below. It might fail completely. This one works by looping through all the files in a directory, open each one and runs the commands in order. Commands might be AutoCAD commands, might be LISP routines - add them in just as you would using the command line (so for example, no need to put (Command "Line" 0,0 10,0), you can just do 'Line' as one line, 0,0 as the next and 10,0 as the next).... I wrote it so know how it works... It opens, changes , saves and closes each drawing, so not as quick as say Scrptwriterpro or Lee Macs scriptwriter, but I find the interface more intuitive for me (which is how I designed it!), and easier than using the core console. I reckon it will plot to PDF about 10 files a minute... 1000 files... about 90 minutes.... so not the quickest.. a lunchtime job? Next step slower from this is to put the LISP as AutoStarting (so load the LISP and then straight after the line "(C:LTrans)" to get it to run, open the files manually and it should run... but that is a last resort. acet - Express Tools - do you need to load them for each drawing / wait for them to be loaded before you can run the command ? Express Tool are an additional set of tools, loaded after the main CAD program starts, Might be wrong but a .bat file doesn't open each drawing does it? Works with the drawings closed... and so the express Tools aren't loaded and available for use.
    1 point
  9. @Wilkibob you cannot run "acet-laytrans" like an AutoCAD command. It has to be run directly as a function. Try changing: (command ("acet-laytrans" "c:/users/joe.bloggs/Downloads/Steelwork.dws" 0)) to just: (acet-laytrans "c:/users/joe.bloggs/Downloads/Steelwork.dws" 0) NOTE - you can run this directly from the script with no need to define it in a defun and load it from a lsp file. Try this in your script: (arxload "acetutil.arx") (acet-laytrans "c:/users/joe.bloggs/Downloads/Steelwork.dws" 0) qsave close Ref: AutoCAD 2025 Help | acet-laytrans (AutoLISP) | Autodesk https://help.autodesk.com/view/ACD/2025/ENU/?guid=GUID-4BD312D1-1850-4DE4-A63D-35367C5F7F5D
    1 point
  10. @BHenry85 Give this version a try for nested values. ;; https://www.cadtutor.net/forum/topic/75699-remove-duplicates-in-list/page/2/#findComment-660223 ;; Detail Extractor v2.5.lsp ;; Write list of details used in model/lot to csv file in location defined by user ;; Removes duplicates from list and only lists unique values ;; Prompts user to open file once complete or not ;; ______________________________________________________________________________________ ;; RJP » 2025-01-01 - REWRITE (defun c:dext (/ a b blk cells lst myxl row x) (vl-load-com) ;; Get Attribute Value - Lee Mac ;; Returns the value held by the specified tag within the supplied block, if present. ;; blk - [vla] VLA Block Reference Object ;; tag - [str] Attribute TagString ;; Returns: [str] Attribute value, else nil if tag is not found. (defun lm:vl-getattributevalue (blk tag) (setq tag (strcase tag)) (vl-some '(lambda (att) (if (= tag (strcase (vla-get-tagstring att))) (vla-get-textstring att) ) ) (vlax-invoke blk 'getattributes) ) ) ;; Thanks to fixo ;; = Set Excel cell text = (defun xlsetcelltext (row column text) (setq cells (vlax-get-property (vlax-get-property myxl "ActiveSheet") "Cells")) (vl-catch-all-apply 'vlax-put-property (list cells 'item row column (vlax-make-variant (vl-princ-to-string text) vlax-vbstring)) ) ) ;; RJP » GET NESTED VALUES (vlax-for a (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))) (vlax-for blk a (if (and (= "AcDbBlockReference" (vla-get-objectname blk)) (= -1 (vlax-get blk 'hasattributes)) (setq a (lm:vl-getattributevalue blk "DETAIL_NUMBER")) (setq b (lm:vl-getattributevalue blk "SHEET_NUMBER")) ) (or (member (setq x (strcat "`" a "-" b)) lst) (setq lst (cons x lst))) ) ) ) (if lst (progn (or (setq myxl (vlax-get-object "Excel.Application")) (setq myxl (vlax-get-or-create-object "Excel.Application")) ) (vla-put-visible myxl :vlax-true) (vlax-put-property myxl 'screenupdating :vlax-true) (vlax-put-property myxl 'displayalerts :vlax-true) (vlax-invoke-method (vlax-get-property myxl 'workbooks) 'add) (setq row 0) (foreach itm (vl-sort lst '<) (xlsetcelltext (setq row (1+ row)) 1 itm)) ) (print "NO VALUES FOUND...") ) (princ) )
    1 point
  11. Here is some sample code (no error checking) that will set the plot style in the current layout in the current drawing. (setq *acad-object* (vlax-get-acad-object)) (setq *active-document* (vla-get-activedocument *acad-object*)) (setq *active-layout* (vla-get-activelayout *active-document*)) (vla-put-stylesheet *active-layout* "mycustom.ctb")
    1 point
  12. The main reason i used the hatch command is to get an defined Area. For instance if i have 17 hatched squares of different shapes and sizes and i want a total area. i can either 1. hatch every square on the one hatch command hence giving me one hatch, ie this would give me one snap point to check all 17 squares. 2. Hatch every 17 square individually and have 17 snap points. However to select the cumulative area you need select every 17 square snap points and have the property window open Now what i want to do...., Just say i have an existing drawing that needs editing, 8 of the squares have now changed to a new material, hence a new area under is needed. hence i need 1 hatch for the 8 areas. now my question is, is it possible to split an existing hatch rather than deleting and re- hatching? or is the opposite true can you combine two existing hatches into one?
    1 point
×
×
  • Create New...