本帖最后由 kucha007 于 2023-3-20 00:15 编辑
打印样式表全获取会包含stb,利用系统变量判断当前文件的样式模式,然后过滤样式表。
秋枫大佬的批量打印只能选择ctb,估计就是这里做判断了
- (defun K:GetPlotStyleLst (/ DOC Layout ALLPlotStyleLst)
- (vl-load-com)
- (setq DOC (vla-get-ActiveDocument (vlax-get-acad-object))
- Layout (vla-get-activeLayout DOC)
- )
- (vla-RefreshPlotDeviceInfo Layout) ;更新打印机、规范介质和打印样式表信息
- (setq ALLPlotStyleLst (vlax-safearray->list (vlax-variant-value (vla-GetPlotStyleTableNames layout)))) ;获取<打印样式>列表
- ;从列表中移除不含关键词的字符串
- (defun k:Remove-NoChar (Lst Char / item NewLst)
- (setq NewLst '())
- (foreach item Lst
- (if (vl-string-search (strcase Char) (strcase item))
- (setq NewLst (cons item NewLst))
- )
- )
- (reverse NewLst)
- )
- (if (= (getvar "PSTYLEMODE") 1);CTB颜色样式表
- (princ (k:Remove-NoChar ALLPlotStyleLst ".ctb"))
- (princ (k:Remove-NoChar ALLPlotStyleLst ".stb"))
- )
- (princ)
- )
|