MastroLube 发表于 2022-7-5 17:19:15

如果实体

大家好,我有个小问题。。
 
我必须输入一个实体,但它有很多参数。
((-1 . <Nome entità: 7ff5ff013970>) (0 . "XRECORD")
                                 (5 . "57F")
                                 (102 . "{ACAD_REACTORS")
                                 (330 . <Nome entità: 7ff5ff00a2e0>)
                                 (102 . "}")
                                 (330 . <Nome entità: 7ff5ff00a2e0>)
                                 (100 . "AcDbXrecord")
                                 (280 . 1)
                                 (90 . 4)
                                 (90 . 7)
                                 (1 . "568")
                                 (1 . "")
                                 (290 . 0)
                                 (40 . 0.0)
                                 (290 . 0)
                                 (290 . 1)
                                 (290 . 0)
                                 (290 . 1)
                                 (290 . 0)
                                 (290 . 0)
                                 (290 . 0)
                                 (290 . 0)
                                 (290 . 1)
                                 (40 . 0.0)
                                 (70 . 9)
                                 (70 . 0)
                                 (70 . 4)
                                 (70 . 3)
                                 (70 . 3)
                                 (70 . 253)
                                 (70 . 1)
                                 (40 . 1.6)
                                 (40 . 1.6)
                                 (40 . 0.0)
                                 (40 . 1.0)
                                 (1 . "CB_Richiami")
                                 (1 . "ACA_1")
                                 (1 . "ACA_1")
                                 (1 . "")
                                 (1 . "")
                                 (1 . "")
                                 (40 . 1.0)
                                 (290 . 1)
                                 (40 . 0.899037)
                                 (40 . 100.0)
                                 (40 . 0.5)
                                 (40 . 1.0)
                                 (1 . "1")
                                 (1 . "")
                                 (1 . "")
                                 (1 . "")
                                 (1 . "")
                                 (40 . 1.0)
                                 (290 . 1)
                                 (290 . 1)
                                 (40 . 95.0)
                                 (40 . 20.0)
                                 (70 . 0)
                                 (40 . 0.0)
                                 (40 . 0.0)
                                 (40 . 0.0)
                                 (40 . 0.0)
                                 (40 . 0.0)
                                 (1 . "")
                                 (40 . 0.0)
                                 (40 . 0.0)
                                 (40 . 0.5)
                                 (40 . 1.25)
                                 (40 . 0.0)
                                 (40 . 0.0)
                                 (70 . -1)
                                 (70 . 1)
                                 (40 . 1.4)
                                 (1 . "ACA_1")
                                 (1 . "")
                                 (290 . 1)
                                 (70 . 1)
                                 (290 . 1)
                                 (290 . 0)
                                 (1 . "")
                                 (40 . 0.0)
                                 (40 . 0.0)
                                 (290 . 0)
                                 (70 . -1)
                                 (290 . 1)
                                 (1 . "{IdBlocchiEstreminta")
                                 (1 . "56A")
                                 (1 . "56B")
                                 (1 . "IdBlocchiEstreminta}")
                                 (1 . "{IdTxtEtichetta")
                                 (1 . "56C")
                                 (1 . "56E")
                                 (1 . "56D")
                                 (1 . "574")
                                 (1 . "573")
                                 (1 . "IdTxtEtichetta}")
                                 (1 . "{IdTxtCampiSerieBarre")
                                 (1 . "56C")
                                 (1 . "IdTxtCampiSerieBarre}")
                                 (1 . "{PuntiPolilinea")
                                 (1 . "PuntiPolilinea}")
                                 (1 . "569")
                                 (1 . "575")
                                 (70 . 1)
)
 
例如,如果我想更改第四个dxf组(40.x),我应该怎么做?
 
(setq quota (subst (cons 40 0.5)(assoc 40 quota) quota))
(entmod quota)

我的代码只适用于第一个。。
 
谢谢
丹尼斯

Lee Mac 发表于 2022-7-5 17:43:55

这里有一种可能的方法:
(setq cnt 0)
(entmod
   (mapcar
       (function
         (lambda ( itm )
               (if (and (= 40 (car itm)) (= 4 (setq cnt (1+ cnt))))
                  '(40 . 0.5)
                   itm
               )
         )
       )
       quota
   )
)

MastroLube 发表于 2022-7-5 18:13:05

谢谢李先生!你是最棒的

Roy_043 发表于 2022-7-5 18:25:23

AFAIK您不能“entmod”xrecord。请参见此处。
页: [1]
查看完整版本: 如果实体