马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
- (defun c:addMyLayout ()
- (vl-load-com)
- (setq acadApp (vlax-get-Acad-object))
- (setq acadDoc (vla-get-ActiveDocument acadApp))
- (setq layouts (vla-get-Layouts acadDoc))
-
- ;; Delete the layout named "Test" if it exists
- (vlax-for objLayout layouts
- (if (= (vla-get-name objLayout) "Test")
- (progn
- (princ
- (strcat "\nDeleted Layout named "
- (vla-get-name objLayout) "..."
- )
- )
- (vla-delete objLayout) ;delete the Layout
- (vlax-release-object objLayout) ; release the Layout Object
- );progn
- );if
- ) ;vlax-for
-
- (setq layoutObj (vla-add layouts "Test"))
-
- ;; Assign Grayscale.CTB to the Layout
- (vla-put-StyleSheet layoutObj "Grayscale.ctb")
-
- ;; Assign DWF configuration to the Layout
- (if (= (substr (vlax-variant-value (vla-getvariable acadDoc "ACADVER")) 1 2) "15")
- (vla-put-configname layoutObj "PublishToWeb DWF.pc3")
- (vla-put-configname layoutObj "DWF6 ePlot.pc3")
- ) ;if
-
- ;; Assign Paper Size B to the Layout
- (vla-put-canonicalmedianame
- layoutObj
- "ANSI_expand_B_(11.00_x_17.00_Inches)"
- )
-
- ;; Make the new Layout Active
- (vla-put-activelayout acadDoc layoutObj)
-
- ;; Example getting StyleSheet and Configname, not doing anything
- ;; with them here however
- (setq currPStyle (vla-Get-StyleSheet layoutObj))
- (setq currConfig (vla-Get-configname layoutObj))
- (princ)
- )
|