Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Lisp program to help with exportlayout command

0 REPLIES 0
Reply
Message 1 of 1
Greatwhitenorth
520 Views, 0 Replies

Lisp program to help with exportlayout command

Hi.  Looking for help with creating a lisp program to do what we're doing manually.  To scale an exported layout drawing and the dimensions.

 

1. open Layout tab to be exported

2. make note of the viewport scale using VPSCALE

3. run EXPORTLAYOUT command

4. open the exported drawing

5. SCALE "all" at basepoint 0,0 to the scale noted in #2

6. run DimUpd.lsp (found on CADTutor.net site created by Lee Mac)

 

Here's the DimUpd.lsp file:

 

; by Lee Mac from CADTutor.net

(defun c:DimUpd ( / *error* _StartUndo _EndUndo _SwapProps doc ss )
  (vl-load-com)
  ;; © Lee Mac 2010

  (defun *error* ( msg )
    (and doc (_EndUndo doc))
    (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")
        (princ (strcat "\n** Error: " msg " **")))
    (princ)
  )

  (defun _StartUndo ( doc ) (_EndUndo doc)
    (vla-StartUndoMark doc)
  )

  (defun _EndUndo ( doc )
    (if (= 8 (logand 8 (getvar 'UNDOCTL)))
      (vla-EndUndoMark doc)
    )
  )

  (defun _SwapProps ( obj prop1 prop2 / tmp )
    (if (and (vlax-property-available-p obj prop1 t)
             (vlax-property-available-p obj prop2 t)
        )
      (progn (setq tmp (vlax-get-property obj prop1))
        (vlax-put-property obj prop1 (vlax-get-property obj prop2))
        (vlax-put-property obj prop2 tmp)
      )
    )
  )

  (setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))

  (if (ssget "_X" '((0 . "*DIMENSION")))
    (progn      
      (_StartUndo doc)
      
      (vlax-for o (setq ss (vla-get-ActiveSelectionSet doc))
        (_SwapProps o 'LinearScaleFactor 'ScaleFactor)
      )

      (vla-delete ss)

      (_EndUndo doc)
    )
  )

  (princ)
)

  

Could someone please help me out with this?

 

Thanks in advance.

 

Bob

____________________________________________________
Product Design & Manufacturing Collection 2021 | Vault Professional 2021
Dell Precision 7670 | Intel i7-12850HX - 2100 Mhz - 64GB
nVIDIA RTX A3000 12GB | Windows 10/64 Pro
0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost