Checking understanding of lisp

Checking understanding of lisp

bemmer7MZ3G
Contributor Contributor
1,293 Views
13 Replies
Message 1 of 14

Checking understanding of lisp

bemmer7MZ3G
Contributor
Contributor

I have a lisp file that I have posted here before. My company has had this for a while and the person who made it is no longer here. I have just started to learn LISP and want to make sure my understanding of what is happening in this code is good (there were no comments or explanations before). There are also some other things that I do not understand how it happens. I have attached the file this was created for, it should grab each part block on the specified dots and print them to a pdf automatically.

0 Likes
1,294 Views
13 Replies
Replies (13)
Message 2 of 14

paullimapa
Mentor
Mentor

Overall you got most of everything correct...good job!!!

There's just some terminology when it comes to entity data associated pairs aka DXF codes.

You can look these up here which I also commented in your lisp code:

; general codes:

https://help.autodesk.com/view/ACD/2024/ENU/?guid=GUID-3F0380A5-1C15-464D-BC66-2C5F094BCFB9

; attribute codes:

https://help.autodesk.com/view/ACD/2024/ENU/?guid=GUID-7DD8B495-C3F8-48CD-A766-14F9D7D0DD9B

Perhaps the next thing to try is instead of Export to PDF is to Plot to PDF.

Let me give you a head start on that here:

(command "_.Plot"
         "_Yes"       ; Detailed plot configuration? [Yes/No] <No>:
         ""           ; Enter a layout name or [?]:
         "DWG TO PDF.PC3" ; Enter an output device name or [?] 
         "ANSI expand B (17.00 x 11.00 Inches)" ; Enter paper size or [?]                              
         "_Inches"    ; Enter paper units [Inches/Millimeters] 
         "_Landscape" ; Enter drawing orientation [Portrait/Landscape] 
         "_No"        ; Plot upside down? [Yes/No]
         "_Window"    ; Enter plot area [Display/Extents/Limits/View/Window]
         ll           ; lower left
         ur           ; upper right
         "1:1"       ; Enter plot scale (Plotted Inches=Drawing Units) or [Fit]
         "_Center"   ; Enter plot offset (x,y) or [Center] 
         "_Yes"      ; Plot with plot styles? [Yes/No]
         "acad.ctb"  ; Enter plot style table name or [?] (enter . for none)
         "_Yes"      ; Plot with lineweights? [Yes/No]
)
(if (/= (getvar "ctab") "Model")
 (command 
   "_No"   ; Scale lineweights with plot scale? [Yes/No]
   "_No"   ; Plot paper space first? [Yes/No]
   "_No"   ; Hide paperspace objects? [Yes/No]
   pdffile 
   "_No"   ; Save changes to page setup [Yes/No]
   "_Yes"  ; Proceed with plot [Yes/No]
 )
 (command
   ""      ; Enter shade plot setting [As displayed/legacy Wireframe/legacy Hidden/Visual styles/Rendered] 
   pdffile
   "_No"   ; Save changes to page setup [Yes/No]
   "_Yes"  ; Proceed with plot [Yes/No]
 )
)

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 3 of 14

john.uhden
Mentor
Mentor

@bemmer7MZ3G ,

As @paullimapa pointed out, you have to learn some basic DXF codes...

   2 is for block name if it is an insert

   8 if for insertion layer name

John F. Uhden

0 Likes
Message 4 of 14

Sea-Haven
Mentor
Mentor

Like others I use layouts as preferred method. But I guess your locked in, much easier to point to an area in Model, enter a scale and layout made. So no need for 100 layouts when only want 10. Title block updated as layout made.

SeaHaven_0-1705636471485.png

 

 

Have seen this dwg before a few times maybe.

0 Likes
Message 5 of 14

bemmer7MZ3G
Contributor
Contributor

This is excellent help, thank you! So the plot code that you provided would replace only the command export line? I would like to try this method to see the difference in speed.

0 Likes
Message 6 of 14

paullimapa
Mentor
Mentor

**Updated**

The part of the plot code I posted which should replace your this part of the code:

(command "-export" "_P" "_W" ll ur "_N" pdffile) ; export a pdf using window based on ll and ur, named pdffile

would need the following adjustments to match your page setup:

1. the paper size:

"ANSI expand B (17.00 x 11.00 Inches)" ; Enter paper size or [?]

Your current page setup uses: 

"ANSI full bleed A (8.50 x 11.00 Inches)"

 

2. the plot scale:

"1:1"       ; Enter plot scale (Plotted Inches=Drawing Units) or [Fit]

Your current page setup uses:

"_Fit"

 

3. the plot style table name:

"acad.ctb" ; Enter plot style table name or [?] (enter . for none)

Your current page setup uses:

"monochrome.ctb"


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 7 of 14

bemmer7MZ3G
Contributor
Contributor

In trying this out, I am getting the "Plot Job Already In Progress" message, is this also happening for others or do I have a setting that needs to be changed?

0 Likes
Message 8 of 14

paullimapa
Mentor
Mentor

That should be correct since you're now plotting to generate the pdf file and not exporting. That message should go away when all the plots to generate the pdf files are completed.

I would also run AutoCAD's Options command and click on Plot and Publish tab and make sure Background processing are both unchecked:

paullimapa_0-1705688339757.png

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 9 of 14

bemmer7MZ3G
Contributor
Contributor

They are, but the code will only pdf one item until I select ok on the box. Is there a way to make it select ok for it to continue to run until it is done?

0 Likes
Message 10 of 14

paullimapa
Mentor
Mentor

That's odd it would prompt to click OK.

Could you do a screen capture showing that prompt and then post it here?


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 11 of 14

bemmer7MZ3G
Contributor
Contributor

bemmer7MZ3G_0-1705695985784.png

 

0 Likes
Message 12 of 14

paullimapa
Mentor
Mentor

according to Autodesk that popop should not occur once you unchecked background plotting as I had posted earlier:

https://www.autodesk.com/support/technical/article/caas/sfdcarticles/sfdcarticles/Error-A-plot-or-pu...


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 13 of 14

john.uhden
Mentor
Mentor

@paullimapa ,

As many of us know, some settings you change don't take place until you start AutoCAD again, and then it's fixed until changed again.  I've discovered this to be true even if I slam-dunk the registry.

John F. Uhden

Message 14 of 14

Sea-Haven
Mentor
Mentor

Going back to your drawing with its 100 title blocks, do you delete unused before hitting plot ? You should be able to select the title blocks in some sort of order, then make multiple pdfs, I use ghostscript then to join the pdfs back into 1 big PDF. The joing order is based on the selection order. I did 88 layouts one go just watched the screen flash, using a plot lisp same method as suggested by Paullimapa, it was fast.

 

You can sort on say X & Y selecting all title blocks. So plot is in correct order. One of the reasons I stay away from PUBLISH, just click a button and watch them coming out.

0 Likes