我在哪里可以找到#039;c组
大家好。我正在构建一个lisp来生成/更改/复制层。
但我遗漏了几个“代码”。
到目前为止,我在这里:
<lots of code>
(setq layerinf (tblsearch "LAYER" currentlayer)) ;; get the layer data
(setq layeronoff (cdr (assoc ?? layerinf))) ;; get the layer on/off
(setq layerfreezethaw (cdr (assoc ?? layerinf))) ;; get the layer freeze/thaw
(setq layerunlockedlocked (cdr (assoc ?? layerinf))) ;; get the layer unlocked/locked
(setq layercol (cdr (assoc 70 layerinf))) ;; get the layer colour (woohoo got that one)
(setq layerlinetype (cdr (assoc ?? layerinf))) ;; get the layer linetype
(setq layerlineweight (cdr (assoc ?? layerinf))) ;; get the layer lineweight
(setq layertrans (cdr (assoc ?? layerinf))) ;; get the layer transparency
(setq layerplot (cdr (assoc ?? layerinf))) ;; get the layer plot yes/no
(setq layerNVPF (cdr (assoc ?? layerinf))) ;; get the layer new vieuwport freeze
(setq layerdiscription (cdr (assoc ?? layerinf))) ;; get the layer discription
<lots of code>
有什么方法可以让我自己找到任务编号吗??? http://www.autodesk.com/techpubs/autocad/acadr14/dxf/ 要在谷歌上查找最新信息:
AutoCAD DXF Reference 我发现并不是所有的图层属性都可以通过这种方法复制到setq。如何复制层并为其命名。使用选定对象的层作为参考?
考虑以下功能:
;; Copy Layer-Lee Mac
;; Copies a layer, retaining all properties
;; src - Layer to copy
;; new - Layer name for copy
;; Returns: Entity name of new layer
(defun LM:copylayer ( src new / lay )
(if (setq lay (tblobjname "layer" src))
(entmakex
(setq lay (entget lay)
lay (subst (cons 2 new) (assoc 2 lay) (vl-remove-if '(lambda ( x ) (member (car x) '(102 360))) lay))
)
)
)
) 我认为OP有学习潜力,下面是一些教程:
(defun C:test
( / myLoop NewLayerName e LyrName LyrEname LyrDXF ) ; declare our local variables - everything thats used with (setq) [ unless we know what we're doing ]
(setq myLoop T) ; define a flag which is "True"
(while myLoop ; construct a pseudo-loop
(setq NewLayerName (getstring t "\nSpecify new layer name: ")) ; prompt user for a layer name
(cond ; start analysing whats provided from the user
((not (snvalid NewLayerName))
(princ "\nInvalid layer name is specified.")
)
((tblobjname "LAYER" NewLayerName)
(princ (strcat "\n \"" NewLayerName "\" already exists."))
)
(NewLayerName ; NewLayerName is provided, and the above statements guarantee everything is OK.
(setq myLoop nil) ; stop the loop and continue
)
(T nil) ; otherwise do nothing
); cond
); while
(if (setq e (car (entsel "\nSelect object on a layer to copy its properties: "))) ; prompt user to select an entity
(progn ; if entity is selected do the following:
(setq LyrName (cdr (assoc 8 (entget e)))) ; get the entity's layer name
(setq LyrEname (tblobjname "LAYER" LyrName)) ; get the layer's ENAME
(setq LyrDXF (entget LyrEname)) ; get the layer's DXF data
(entmakex ; create the layer, using the modified DXF list
(subst (cons 2 NewLayerName) (assoc 2 LyrDXF) ; change/substitute the Layer's name in the DXF list
(vl-remove-if '(lambda (x) (member (car x) '( -1 330 5 102 360 390 347 348))) LyrDXF) ; remove unwanted group codes from the existing the DXF list and keep the rest
); subst
); entmakex
(setvar 'clayer NewLayerName) ; set the newly created layer as current
); progn
); if e
(princ); exit cleanly
); defun
(vl-load-com); load the visual lisp extensions
有趣的是,Lee和Grrr正在从源实体列表中删除不同的组码。我将使用李的列表,但添加-1和5(不是因为这是必需的,而是为了清楚起见)。
@Grrr:
将层覆盖应用于层,并了解有关gc 102和360的更多信息。
gc 348用于什么? 大家好,谢谢你们的密码。
上周,我阅读了AfraLisp、CadTutor、Lee Mac和JefferySanders的所有教程。
到目前为止,我学到了很多,现在我正在尝试使用一切
尽管我必须说,我找不到很多使用“vlax”方法的教程???
在我发表最初的帖子之前,这就是我所拥有的。
(defun C:WisselStatus()
(setvar "cmdecho" 0)
(command "UNDO" "BEGIN")
(setq objecten (ssget ":L"))
(initget "B V T N R X")
(setq nieuwestatus (getkword "\nWissel status naar: : "))
(if (= nieuwestatus nil)
(progn
(princ "\nLagen ongewijzigd...")
)
(progn
(setq i 0 n 0)
(setq userlayer (getvar "CLAYER"))
(setq n (sslength objecten))
(repeat n
(setq e (ssname objecten i)) ;get an ename
(setq enx (entget e)) ; get entity's data
(setq currentlayer (cdr (assoc 8 enx))) ;get entity's layer
(setq newlayer (strcat nieuwestatus (substr currentlayer 2))) ; set the new layer name for entity's
(if (tblsearch "LAYER" newlayer)
(progn ;direct verplaatsen
(setq enx (subst (cons 8 newlayer) (assoc 8 enx) enx)) ;change (substitute) the layer association of its data
(entmod enx) ; modify the entity
)
(progn ;eerst laag aanmaken en dan verplaatsen
(setq layerinfo (tblsearch "LAYER" currentlayer)) ;get the layer data
(setq layercolor (cdr (assoc 62 layerinfo))) ;get the layer colour
(setq layerlinetype (cdr (assoc 6 layerinfo))) ;get the layer linetype
(command "-Layer" "M" newlayer "C" layercolor "" "L" layerlinetype "" "")
(setq enx (subst (cons 8 newlayer) (assoc 8 enx) enx)) ;change (substitute) the layer association of its data
(entmod enx) ; modify the entity
(command "-purge" "LA" currentlayer "" "Y")
)
)
(setq i (1+ i))
)
)
)
(if (tblsearch "LAYER" userlayer)
(setvar "CLAYER" userlayer)
(setvar "CLAYER" newlayer)
)
(command "UNDO" "END")
(setvar "cmdecho" 1)
(princ)
)
(princ)
今天晚些时候,我会尝试插入给定的代码,但只是想说明我目前的困境。。。
谢谢你,罗伊,我还没想过要被否决。
这是我检查一些图层时的dxf列表:
我认为删除带有ename和句柄GC的所有GC是合乎逻辑的。我学习了LM的Entmake函数,因此留下了其他表示层属性和子类标记的GC。
关于GC 348,我找不到任何信息,也没有权限检查,因为我在尝试时收到错误:
但这个名称对我来说很熟悉,所以我发现它指的是(namedobjdict)名称:
顺便说一句,当我对同一层应用覆盖时,又出现了一个GC 390:
Inspect工具显示其:(0。“ACDBPLACEHOLDER”)-为什么不也删除它? 具有覆盖(而非可见性覆盖)的图层将具有扩展字典。因此,其实体列表中存在组码102和360。
组码348的存在令人惊讶。尤其是因为它没有引用实际实体。对我来说似乎是个虫子。
页:
[1]
2