All Activity
- Past hour
-
defid joined the community
- Today
-
Help Appreciated: Force Existing Layer Names to UPPER CASE Not Working
Clint replied to Clint's topic in AutoLISP, Visual LISP & DCL
Hi Steven, This is good to know. I will check out BigAL's related post very soon. Your responses are reassuring and well received! My task is to hash out a program that reads from two lists and updates layer names to match the old version to both the current name (UPPERCASE). Thanks, Clint Hill -
Steven P started following Help Appreciated: Force Existing Layer Names to UPPER CASE Not Working
-
Help Appreciated: Force Existing Layer Names to UPPER CASE Not Working
Steven P replied to Clint's topic in AutoLISP, Visual LISP & DCL
Obviously we don't have your batch LISP - I guess your company paid for this and so you are not going to be popular sharing that for all online. LISPs can be added to scripts - both as a command and as code. There are others out there such as ScriptPro and Lee Macs Script Writer which will do this. BigAl will often post snippets of scripts here to batch process files - last one he did was in the last week or so ago. You could even set this up as a stand alone script to do just the one task (see BigAls last example....) The first step for all is to get a LISP working as you want and well on a single file and then to do it as a batch (first time running the batch with a new LISP, perhaps check carefully that it doesn't do anything unexpected on other files). Plenty of examples out there to change layer names from one to another - have a look to see if you see one you like to use, or if there isn't am sure we can put one together - and use what is above as a started if you want to have a go, I think all the code you need is in the examples, just need to think how to change them to your needs -
Clint started following Help on "; error : Automation Error. Property [NAME] not available"
-
Help on "; error : Automation Error. Property [NAME] not available"
Clint posted a topic in AutoLISP, Visual LISP & DCL
I obtained the attached program from another. In initial running of this program ONLY, I am experiencing the subject line error. (I run this in BricsCAD V25 & V26) The program continues to run and produces the desired results. IMPORTANT In later runs, it does not appear. BACKGROUND I attempted to debug in the BricsCAD BLADE programming environment (similar to AutoCAD's VLIDE) but have limited experience so far. QUESTIONS What is causing the following error? How do I correct it? -------- COMMAND ERROR MESSAGE ------- Select groups to be exploded: Select entities: Entities in set: 9 Select entities: ; error : Automation Error. Property [NAME] not available ------ Best regards, Clint Hill quickungroup.lsp -
Help Appreciated: Force Existing Layer Names to UPPER CASE Not Working
Clint replied to Clint's topic in AutoLISP, Visual LISP & DCL
Gentlemen, I think it best to explore the following pursuit "B" in a new post. -
Import multipage PDF as AutoCAD Objects
rlx replied to SLW210's topic in AutoLISP, Visual LISP & DCL
maybe its just a matter of name vs effective block name issue , haven't tested that. But I like the routine and maybe gonna extend it a little with above suggestions if I run into a project that could benefit from this. Did find a program , I think it's called able2extact or something , that also has OCR built in but it will set you back around two hundred dollars , lifte time subscription. -
Import multipage PDF as AutoCAD Objects
SLW210 replied to SLW210's topic in AutoLISP, Visual LISP & DCL
I only used it twice and it worked fine on those, latest one was 8 sheets, the first time was a while back not sure how many sheets. IIRC, it may only work on AutoCAD 2024 or newer in this version. Tested on AutoCAD 2026. I did this several months ago and just needed it again yesterday. So @rlx's addition may be needed for older. @BIGAL I thought about do a count, but I don't need it. I'll try to find time to research BricsCAD use. I was working on creating a Layout tab for each sheet, I might get back to it later, busy with paid work right now. Only other update I plan is maybe get more than one PDF, but that will much further down the line. -
Steven P started following Publish as PDF,Purge all and save as dxf binary 2007
-
Publish as PDF,Purge all and save as dxf binary 2007
Steven P replied to pyou's topic in AutoLISP, Visual LISP & DCL
Mine are 'plotPDF' for full size and then plotPDFA3, plotPDFA4 - no further actions needed - same as BigAL and RLX suggest -
eastonbray joined the community
-
++
-
Publish as PDF,Purge all and save as dxf binary 2007
BIGAL replied to pyou's topic in AutoLISP, Visual LISP & DCL
Like @rlx this is a hard coded plot pdf using preset values, our dwg's used layouts one title block. the code is hard coded for a A1 sheet plotted as a A3 size. We just walked through the layouts and plotted. So does not matter what current plot settings are as they are ignored. We had multiple devices PDF, A1, A3 Color, A3 B-W. So code for each. (setvar "textfill" 1) (setvar "fillmode" 1) (COMMAND "-PLOT" "Y" "" "Plot To PDF" "Iso full bleed A3 (420.00 x 297.00 MM)" "m" "LANDSCAPE" "N" "W" "-6,-6" "807,560" "1=2" "C" "y" "Acad.ctb" "Y" "n" "n" "n" pdfName "N" "y" ) -
Import multipage PDF as AutoCAD Objects
BIGAL replied to SLW210's topic in AutoLISP, Visual LISP & DCL
@SLW210 have a look at this by Lee-mac may be useful. I did have problems may be my Bricscad or pdf I am using. https://www.theswamp.org/index.php?PHPSESSID=a86a2d2e880b6079f1d3aee842f41d9d&topic=39001.msg441632#msg441632 This may also be useful once you know count. (if (not AH:getvalsm)(load "Multi Getvals.lsp")) (setq vals (AH:getvalsm (list "Enter Pdf range" "Enter start Pdf number" 6 4 "1" "Enter end Pdf number" 6 4 (RTOS COUNT 2 0)))) ("1" "22") - Yesterday
-
Help Appreciated: Force Existing Layer Names to UPPER CASE Not Working
BIGAL replied to Clint's topic in AutoLISP, Visual LISP & DCL
If you google "Win 11 screen capture" it will talk about shift+window+R, nice thing is in web information is how to set the destination directory for the recording. So mine are set high in a drive easy to find compared to default buried in C:\Users -
ronjonp started following Please help with this z0
-
This does the same thing (ssget "_X" '((0 . "~3DSOLID"))) It's like Marko's above but CONS is not needed.
-
[VLX] SectionSync LITE – Viewport sync along a polyline path (Civil 3D/AutoCAD)
rlx replied to AutoLISP Wizard's topic in AutoLISP, Visual LISP & DCL
First of all , welcome to Cadtutor AutoLisp Wizard! My kind of work is 99% electrical & instrument loop diagrams so I don't often have to work with viewports and when I do its just for simple cabinet views and some instrument layouts. But I do appreciate users who contribute and share their hard work with other users , so although I'm not gonna use it my self , thank you for your contribution. -
[VLX] SectionSync LITE – Viewport sync along a polyline path (Civil 3D/AutoCAD)
BIGAL replied to AutoLISP Wizard's topic in AutoLISP, Visual LISP & DCL
Welcome aboard,. Nice idea doing two vports per sheet. For where I worked it was a plan view at top and the corresponding long section below. We used Civil Site Design as an add on so it did all this in the package. Runs on CIV3D or Bricscad. Yep like this I did years ago, also pick a point, make repeated rectangs based on a hor/ver pattern. All rotate the viewport where required. have done around 70+ in one go. You could move, rotate, add or delete a rectang then make layouts. There may be something in below that you may want to add to your code happy to explain how. Draw rectangs.mp4 Something you may be interested in draws grid in paperspace based on viewport including twisted vport. Has a dcl front end for control of how grid looks. -
Publish as PDF,Purge all and save as dxf binary 2007
rlx replied to pyou's topic in AutoLISP, Visual LISP & DCL
maybe just something simple as : (setvar "filedia" 0) (command ".-plot" "No" "" "" "" (strcat (getvar 'dwgprefix) (getvar 'ctab) ".pdf") "No" "Yes") (setvar "filedia" 1) -
seyit joined the community
-
Publish as PDF,Purge all and save as dxf binary 2007
pyou replied to pyou's topic in AutoLISP, Visual LISP & DCL
How do incorporate publish pdf with present default settings? Basically just (_publish " ") and ENTER, but it keeps asking me for more information , need just pdf export with present default settings as it is. -
its great, thanks
-
Detect Circular Xref in AutoLISP
Ahankhah replied to Ahankhah's topic in AutoLISP, Visual LISP & DCL
Steven, thank you very much. I will review it and get back to you. I truly appreciate your help.- 4 replies
-
- xref
- circular reference
-
(and 2 more)
Tagged with:
-
Detect Circular Xref in AutoLISP
Ahankhah replied to Ahankhah's topic in AutoLISP, Visual LISP & DCL
mhupp, I want AutoLISP code to do that.- 4 replies
-
- 1
-
-
- xref
- circular reference
-
(and 2 more)
Tagged with:
-
I know that this is old, but did you find a solution? I am wondering if you are sure that you are pathed to the metric pipe catalog?...
-
Import multipage PDF as AutoCAD Objects
rlx replied to SLW210's topic in AutoLISP, Visual LISP & DCL
Great! Thanx! It did gave me an error after the first page so I changed one of your subs a little. added this line : (and blkRef (vlax-method-applicable-p blkRef 'Name)) (defun set-block-contents-color (blkRef layer color / blkDef) (if (and blkRef (vlax-method-applicable-p blkRef 'Name)) (progn (setq blkDef (vla-item (vla-get-Blocks doc) (vla-get-Name blkRef))) (vlax-for ent blkDef (vl-catch-all-apply 'vla-put-layer (list ent layer)) (vl-catch-all-apply 'vla-put-color (list ent color)) ) ) ) ) -
Help Appreciated: Force Existing Layer Names to UPPER CASE Not Working
mhupp replied to Clint's topic in AutoLISP, Visual LISP & DCL
-
nnn13 joined the community
-
Help Appreciated: Force Existing Layer Names to UPPER CASE Not Working
Clint replied to Clint's topic in AutoLISP, Visual LISP & DCL
This is very superior feedback from both of you! Thanks a million! About this layer name conversion task: Expect all things to change including CAD standard layer name text cases! LAYER NAME TEXT CONVERSION BATCH PROCESSING - calling LISPS in SCRIPT FILES A BricsCAD-based, custom batch file program (Batcher.lsp) as developed for my company very recently. Currently it processes .SCR file types. QUESTION 1: Can .LSP programs be included from within script code lines? If so, ... BATH PROCESSING - SCRIPT FILE PURSUIT A: Convert both existing Title Case & lower case to UPPER CASE BATH PROCESSING - SCRIPT FILE PURSUIT B: Batch convert via the following LISP program. Prerequisite: Researching how to create the following LISP program Create a AutoLISP/Visual LISP program called LAYSUB.lsp This program reads from a old layer name list and a current layer list.* When old names are found from the old layer list, the program replaces the old layer string with current layer string. Proposed LISP Step 1: (*) Create a program resource text file for each layer list, old and current layer names as a program resource file. Proposed LISP Step 2: If old layers name case-sensitive string exist, substitute them with the new layer name case sensitive (UPPER) that is based on the two text file lists. SUMMARY Do the above pursuits sound reasonably practical for batch processing? Best regards, Clint Hill -
I don't believe I posted my Import multiple PDF pages as AutoCAD objects LISP. It does most of what I need, so I doubt if I'll spend any more time on it. ;;; Imports indicated page(s), converts to DWG entities, then arranges them spaced along +X. | ;;;-----------------------------------------------------------------------------------------------| ;;; ImPDF.lsp | ;;; | ;;; By SLW210 (a.k.a. Steve Wilson) | ;;; | ;;; Requires: AutoCAD 2017 + (for PDFIMPORT) | ;;;-----------------------------------------------------------------------------------------------| (defun c:ImPDF (/ pdfPath pgStart pgEnd pg insPt gap doc ms layerColor bgColor layerName blk ) (vl-load-com) ;; Detect background color (setq bgColor (getvar "BACKGROUNDCOLOR")) ; 0=black, 7=white (setq layerColor (if (= bgColor 0) 7 0 ) ) ; white on black, black on white ;; Select PDF file (setq pdfPath (getfiled "Select PDF file to import" "" "pdf" 8)) (if (not pdfPath) (exit) ) ;; Page range (setq pgStart (getint "\nStart page <1>: ")) (if (not pgStart) (setq pgStart 1) ) (setq pgEnd (getint "\nEnd page <same>: ")) (if (not pgEnd) (setq pgEnd pgStart) ) ;; Starting insertion point (setq insPt (getpoint "\nInsertion point: ")) (if (not insPt) (setq insPt '(0 0 0)) ) ;; Gap between pages (setq gap (getreal "\nGap between pages <5.0>: ")) (if (not gap) (setq gap 5.0) ) ;; Get AutoCAD document (setq doc (vla-get-ActiveDocument (vlax-get-acad-object))) ;; Set all entities inside block definition to layer + color (defun set-block-contents-color (blkRef layer color / blkDef) (setq blkDef (vla-item (vla-get-Blocks doc) (vla-get-Name blkRef))) (vlax-for ent blkDef (vl-catch-all-apply 'vla-put-layer (list ent layer)) (vl-catch-all-apply 'vla-put-color (list ent color)) ) ) ;; Loop through pages (setq pg pgStart) (while (<= pg pgEnd) (princ (strcat "\nImporting page " (itoa pg) "...")) ;; Attach PDF underlay (command "_-PDFATTACH" pdfPath (itoa pg) insPt 1.0 0.0) (setq u (entlast)) ;; underlay reference ;; Import to geometry (All, then detach) (command "_PDFIMPORT" u "All" "D") ;; The imported block reference is the last entity (setq blk (entlast)) (if blk (progn ;; Create layer for this page (setq layerName (strcat "PDF_Page_" (itoa pg))) (if (not (tblsearch "layer" layerName)) (vl-catch-all-apply 'vla-Add (list (vla-get-Layers doc) layerName) ) ) ;; Move block reference to layer (vl-catch-all-apply 'vla-put-layer (list (vlax-ename->vla-object blk) layerName) ) ;; Set nested geometry inside block (set-block-contents-color (vlax-ename->vla-object blk) layerName layerColor ) ;; Compute block width for next insertion point (setq minX 1e20 maxX -1e20 ) (vl-catch-all-apply 'vla-getboundingbox (list (vlax-ename->vla-object blk) 'pmin 'pmax) ) (setq pmin (vlax-safearray->list pmin)) (setq pmax (vlax-safearray->list pmax)) (setq width (- (car pmax) (car pmin))) (if (<= width 0.0) (setq width 100.0) ) ;; Update insertion point for next page (setq insPt (list (+ (car insPt) width gap) (cadr insPt) 0)) ) ) ;; Next page (setq pg (1+ pg)) ) (command "_ZOOM" "_E") (princ "\nAll pages imported successfully." ) (princ) )
-
Steven P started following Detect Circular Xref in AutoLISP
-
Detect Circular Xref in AutoLISP
Steven P replied to Ahankhah's topic in AutoLISP, Visual LISP & DCL
AutoCAD is very bad at running a LISP in one file to read another file, it is not something I have looked at with xrefs, however this might give you a starter, listing any xrefs in the current file - I was looking at this to do something different and is in the folder "finish this one day"... so the code might not be 100%. ;;https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/grab-all-xref-names-and-paths/td-p/1661552 ;;(defun filepfil ( / Doc LayoutCol EndList) ;; Returns a list of list of all the Xrefs and Images with their paths within a drawing. (defun c:xreffilepaths ( / ) (defun xreftype ( str / ) ;; (setq lst (list "abcd.dwg" "1234.dwg" "sample drawing with space in file name.dwg" "5566.dwg") ) ;; (mapcar '(lambda (x) ;; (substr x 1 (- (strlen x) 4)) ;; ) ;; lst ;; ) (setq MyLen (strlen str)) (setq MyType (substr str (- MyLen 3) )) ) (setq Doc (vla-get-ActiveDocument (vlax-get-Acad-Object))) (setq LayoutCol (vla-get-Layouts Doc)) (vlax-for i LayoutCol (vlax-for Obj (vla-get-Block i) (cond ((= (vla-get-ObjectName Obj) "AcDbRasterImage") (if (not (assoc (vla-get-Name Obj) EndList)) (setq EndList (cons (cons (vla-get-Name Obj) (vla-get-ImageFile Obj)) EndList)) ) ) ((and (= (vla-get-ObjectName Obj) "AcDbBlockReference") (vlax-property-available-p Obj 'Path)) (if (not (assoc (vla-get-Name Obj) EndList)) (setq EndList (cons (cons (vla-get-Name Obj) (vla-get-Path Obj)) EndList)) ) ) ) ) ) EndList (princ "\nContains Xrefs: ") (princ EndList) (foreach n EndList (if (findfile (cdr n)) () (progn (princ "\nMissing XREF: ") (princ (car n)) ;; (princ n) ) ; end progn ) ; end if ) ; end foreach (setq MyPath (cdr (nth 0 EndList)) ) (setq MyFileType (xreftype (cdr (nth 0 EndList)) )) (setq MyFile (strcat (car (nth 0 EndList)) MyFileType) ) (setq NewPath (strcat (getvar "dwgprefix") (vl-string-trim ".\\\\" MyPath ) )) (if (findfile NewPath) ; find file : if file exists (progn (setq MyPath (vl-string-right-trim MyFile MyPath )) ; take off file from file path (setq NewPath (vl-string-right-trim MyFile NewPath )) ; take off file from file path ) ; end progn (progn ) ; end progn ) ; end if ) Not sure if this is something you can use? https://www.autodesk.com/support/technical/article/caas/sfdcarticles/sfdcarticles/Determining-whether-a-drawing-is-referenced-as-an-xref-in-other-drawings.html- 4 replies
-
- 1
-
-
- xref
- circular reference
-
(and 2 more)
Tagged with:
