Jump to content

Search the Community

Showing results for tags 'rlx'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • CADTutor
    • News, Announcements & FAQ
    • Feedback
  • AutoCAD
    • AutoCAD Beginners' Area
    • AutoCAD 2D Drafting, Object Properties & Interface
    • AutoCAD Drawing Management & Output
    • AutoCAD 3D Modelling & Rendering
    • AutoCAD Vertical Products
    • AutoCAD LT
    • CAD Management
    • AutoCAD Bugs, Error Messages & Quirks
    • AutoCAD General
    • AutoCAD Blogs
  • AutoCAD Customization
    • The CUI, Hatches, Linetypes, Scripts & Macros
    • AutoLISP, Visual LISP & DCL
    • .NET, ObjectARX & VBA
    • Application Beta Testing
    • Application Archive
  • Other Autodesk Products
    • Autodesk 3ds Max
    • Autodesk Revit
    • Autodesk Inventor
    • Autodesk Software General
  • Other CAD Products
    • BricsCAD
    • SketchUp
    • Rhino
    • SolidWorks
    • MicroStation
    • Design Software
    • Catch All
  • Resources
    • Tutorials & Tips'n'Tricks
    • AutoCAD Museum
    • Blocks, Images, Models & Materials
    • Useful Links
  • Community
    • Introduce Yourself
    • Showcase
    • Work In Progress
    • Jobs & Training
    • Chat
    • Competitions


  • Programs and Scripts
  • 2D AutoCAD Blocks
  • 3D AutoCAD Blocks
  • Images
    • Backgrounds

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...

Found 1 result

  1. All, With the help of other lisp routines We have come up with a way to use Publish to make a multi page PDF without using a 3rd party program. Here it is for everyone to look at and use. It works and does what we want it to do but we haven't figured out how to delete the DWG files when it's done Publishing, so if some one could figure that out that would be great. (defun c:pdfpub (/ ob ss bn mn mx) ;; This was created by combining a multitude of different lisp routines by Lee Mac, RLX, Lee Ambrosius, Stephan BMR and howiez69 (vl-load-com) (setq doc (vla-get-ActiveDocument (vlax-get-acad-object))) ;; Get the PlotConfigurations collection (setq plotCfgs (vla-get-PlotConfigurations doc)) ;; Check to see if the pagesetup already exists (setq plotCfg (vl-catch-all-apply 'vla-Item (list plotCfgs "PDFSetup"))) ;; If the page setup exists, the variable will be of type VLA-OBJECT (if (/= (type plotCfg) 'VLA-OBJECT) ;; Create a page setup for model or paper space accordingly (if (= (getvar "TILEMODE") 0) (setq plotCfg (vla-Add plotCfgs "PDFSetup" :vlax-false)) (setq plotCfg (vla-Add plotCfgs "PDFSetup" :vlax-true)) ) ) ;;(vla-put-Name plotCfg "PDFSetup") (vla-RefreshPlotDeviceInfo plotCfg) ;; Set the plot device (vla-put-ConfigName plotCfg "DWG To PDF.pc3") ;; Set the paper size (vla-put-CanonicalMediaName plotCfg "ARCH_full_bleed_C_(24.00_x_18.00_Inches)") ;; Set the plot units (inches, millimeters, pixels) (vla-put-PaperUnits plotCfg acInches) ;; Set what to plot ;; - If using acView, set the ViewToPlot property ;; - If using acWindow, call GetWindowToPlot (if (= (getvar "TILEMODE") 0) (progn (vla-put-PlotType plotCfg acLayout) ;; Set scale (vla-put-UseStandardScale plotCfg :vlax-true) (vla-put-StandardScale plotCfg ac1_1) ) (progn (vla-put-PlotType plotCfg acExtents) ;; Set scale (vla-put-UseStandardScale plotCfg :vlax-true) (vla-put-StandardScale plotCfg acScaleToFit) ) ) ;; Hide paperspace objects (vla-put-PlotHidden plotCfg :vlax-false) ;; Set the plot origin (setq origin (vlax-make-safearray vlax-vbDouble '(0 . 1))) (vlax-safearray-fill origin (list 0.5 0.5)) (vla-put-PlotOrigin plotCfg origin) ;; Set the plot rotation (vla-put-PlotRotation plotCfg ac0degrees) ;; Set viewport plot behavior (vla-put-PlotViewportBorders plotCfg :vlax-false) (vla-put-PlotViewportsFirst plotCfg :vlax-true) ;; Set lineweight behavior (vla-put-PlotWithLineweights plotCfg :vlax-true) (vla-put-ScaleLineweights plotCfg :vlax-true) ;; Set plot styles behavior (vla-put-PlotWithPlotStyles plotCfg :vlax-true) (vla-put-ShowPlotStyles plotCfg :vlax-true) ;; Center the plot on the page (if (= :vlax-false (vla-get-CenterPlot plotCfg)) (vla-put-CenterPlot plotCfg :vlax-true) ) (if (= (getvar "PSTYLEMODE") 0) (vla-put-StyleSheet plotCfg "acad.stb") (vla-put-StyleSheet plotCfg "TFC.ctb") ) ;; Assign the page setup to the current layout (vla-CopyFrom (vla-get-ActiveLayout doc) plotCfg) (vl-cmdf "UCS" "") (setq cnt 0) (if (not (setq folder (getfolder "Select folder to save views"))) (setq folder (getvar 'dwgprefix))(setq folder (strcat folder "\\"))) (if (and (progn (initget "B") (setq ob (entsel "\nSelect Block/B for blockname: ")) (cond ((eq ob "B") (setq bn (getstring "\nEtner Block Name: ")) ) ((and (eq (type ob) 'LIST) (vlax-method-applicable-p (vlax-ename->vla-object (car ob)) 'getboundingbox)) (setq bn (cdr (assoc 2 (entget (car ob)))))))) (tblsearch "BLOCK" bn) bn (setq ss (ssget "_X" (list '(0 . "INSERT")'(410 . "Model")(cons 2 bn)))) ) (progn (vla-zoomextents (vlax-get-acad-object)) (repeat (setq i (sslength ss)) (setq cnt (1+ cnt)) (vla-getboundingbox (vlax-ename->vla-object (ssname ss (setq i (1- i)))) 'mn'mx) (setq tmp (ssget "_C" (trans (vlax-safearray->list mx) 0 1) (trans (vlax-safearray->list mn) 0 1))) (vl-cmdf "_.-wblock" (strcat folder (itoa cnt) "-" (vl-filename-base (getvar 'dwgname)) ".dwg") "" "0,0" tmp "") (command "oops") ) ) (princ "\nNo Blocks Selected: ") )(princ) (defun *error* ( msg ) (setvar "FILEDIA" OldFda) ;sets system variable FILEDIA back to original value (setvar "EXPERT" Save_Expert) ;sets system variable EXPERT back to original value (princ "error: ") (princ msg) (princ) ) (setq OldFda (getvar "FILEDIA")) ;reads current system variable FILEDIA value (setvar "FILEDIA" 0) ;sets FILEDIA to 0 so no dialog boxes popup (setq Save_Expert (getvar "EXPERT")) ;reads current system variable EXPERT value (setvar "EXPERT" 2) ;sets EXPERT to 2 so no dialog boxes popup (setvar "EXPERT" Save_Expert) ;sets system variable EXPERT back to original value (setq pathtxt (strcat folder "TEMP.DSD")) ;sets path for DSD file from current drawing saved location (setq file (open (strcat folder "TEMP.DSD") "w")) ;opens DSD file for writing ;**********START OF DSD FILE********** ;**********START HEADER********** (write-line "[DWF6Version]" file) (write-line "Ver=1" file) (write-line "[DWF6MinorVersion]" file) (write-line "MinorVer=1" file) ;**********END OF HEADER********** ;**********START OF LAYOUTS/DWG TO PLOT********** !!!repeat this section for each of your layouts or dwgs to plot (setq cnt2 0) (repeat (setq i2 (sslength ss)) (setq cnt2 (1+ cnt2)) (setq dname (strcat "[DWF6Sheet:PDF Sheet " (itoa cnt2) "]")) (write-line dname file) (write-line (strcat "DWG=" folder (itoa cnt2) "-" (substr (getvar "dwgname") 1 (- (strlen (getvar "dwgname")) 4)) ".dwg")file) (write-line "Layout=Model" file) ;layout to plot (write-line (strcat "OriginalSheetPath=" (strcat folder (itoa cnt2) "-" (substr (getvar "dwgname") 1 (- (strlen (getvar "dwgname")) 4))".dwg") )file) (write-line "Has Plot Port=0" file) (write-line "Has3DDWF=0" file) (setq i2 (1- i2)) ) ;**********END OF 'ONE' LAYOUT TO PLOT********** !!!repeat previous section for each of your layouts or dwgs to plot ;**********START OF DSD FOOTER********** (write-line "[Target]" file) (write-line "Type=6" file) ;change to "TYPE=6" for multiple output files, "TYPE=5" for single output file (write-line (strcat "DWF=" (strcat folder(substr (getvar "dwgname") 1 (- (strlen (getvar "dwgname")) 4))".pdf") )file) (write-line (strcat "OUT="(strcat folder)) file) (write-line "PWD=" file) ;**********END OF DSD FOOTER********** ;**********END OF DSD FILE********** (close file) ;closes DSD file (command "_.delay" 2000) ;system delay before starting publish command so DSD file closes (command "-Publish" pathtxt ) ;start publish command with TEMP.DSD file just created (setvar "FILEDIA" OldFda) ;sets system variable FILEDIA back to original value (command "_.delay" 2000) ;system delay before deleting TEMP.DSD so publish routine has time to release it (vl-file-delete pathtxt) ;deletes TEMP.DSD file (princ) ) (defun getfolder (msg / fl sh) (if (and (setq sh (vlax-create-object "Shell.Application"))(setq fl (vlax-invoke sh 'browseforfolder 0 msg 0 ""))) (setq fl (vlax-get-property (vlax-get-property fl 'self) 'path))(setq fl nil))(release_me (list sh)) fl) (defun release_me (lst) (mapcar '(lambda (x)(if (and (= 'vla-object (type x))(not (vlax-object-released-p x)))(vlax-release-object x))(set (quote x) nil)) lst)) (princ) Thanks, Brian
  • Create New...