chulse 发表于 2022-7-6 09:38:32

条带外部参照路径?

我从GSA(美国政府机构)收到了这封信,作为一个更大项目的一部分,帮助将文件设置为他们的标准。这一部分似乎不起作用-没有设定路径。
我已经测试了各个部分,但看不出哪里出了问题。
 
如果有人能看一下并告诉我,如果有什么事情看起来不对劲,我将不胜感激。欢迎提出任何建议。谢谢
 
; remove xref paths
; select the first block
(progn
(setq blk (tblnext "BLOCK" 1))
; repeat for each block definition in the drawing
(while (/= blk nil)
; determine if the block is an xref
(setq groupcode70 (cdr (assoc 70 blk)))
; determine if groupcode70 contains a bitwise 4
; this would indicate it is an xref
(if (= 4 (logand 4 groupcode70))
   (progn
   ; if groupcode70 contains a bitwise 32 it is resolved
   (if (= 32 (logand 32 groupcode70))
       (progn
         ; it is resolved
         ; strip out path if present
         (if(setq xrefname (cdr (assoc 1 blk)))
         (if (wcmatch xrefname "*\\*")
         ; change the old name to the new
         (command ".-xref" "p"
                  (cdr (assoc 2 blk))
                  (strcat (vl-filename-base xrefname)(vl-filename-extension xrefname))
         ) ;end command
         )) ;end if
       ) ;end progn
       (progn) ; xref is unresolved - do not try to change it
   )
   )
   (progn) ; the block is not an xref
)
; select the next block
(setq blk (tblnext "BLOCK"))
)
);_end progn

BlackBox 发表于 2022-7-6 10:06:31

这对我来说很有用:
 

(defun c:FOO(/ path)
(vl-load-com)
(vla-startundomark
   (cond (*activeDoc*)
         ((setq *activeDoc*
               (vla-get-activedocument (vlax-get-acad-object))))))
(vlax-for x(vla-get-blocks *activeDoc*)
   (if (and (vlax-property-available-p x 'isxref)
            (= :vlax-true (vla-get-isxref x)))
   (vla-put-path
       x
       (strcat (vl-filename-base (setq path (vla-get-path x)))
               (vl-filename-extension path)))))
(vla-endundomark *activeDoc*)
(princ))

 
编辑-如果不喜欢使用参照管理器,可以将上面发布的代码中的vlax for语句(稍作调整)应用于ObjectDBX函数,该函数将遍历特定项目目录中的所有图形,并对每个图形的“模型”布局的块对象进行此更改(如果适用)(假设外部参照以毫秒为单位)。
 
希望这有帮助!

chulse 发表于 2022-7-6 10:25:54

干净多了,谢谢

BlackBox 发表于 2022-7-6 10:47:39

 
不客气。
页: [1]
查看完整版本: 条带外部参照路径?