hamidciv 发表于 2022-7-5 22:12:23

更改属性请求

嗨,亲爱的朋友们
:(我想写一个简单的代码,在选择显示的所有对象后,使用命令属性更改细节,但我没有成功。
(defun c:测试()
(setq a(ssget“x”))
(命令“select”a)
(命令“属性”)
)
此代码无法正常工作。
请帮帮我
谢谢

BIGAL 发表于 2022-7-5 22:26:12

需要使用CHPROP
 

(defun c:test ()
(setq a (ssget "x"))
(command "CHPROP" a ....) ; you need to add what it is you want to change eg LA for layer
)

hamidciv 发表于 2022-7-5 22:46:59

非常感谢亲爱的比格尔

ttray33y 发表于 2022-7-5 22:52:03

试试这个:

(defun C:test(/ cntr eset en enlist pt clr lay)
;Main Application
;Turn the command echo off
(setvar "cmdecho" 0)
;Prompt the user for information
(setq clr(acad_colordlg 1 nil))
(setq lay(getstring "\n Layer: "))
; Get a selection set
(setq eset
   (ssget
   (list
       (cons -4 "<OR")
         (cons 0 "ARC")
         (cons 0 "ELLIPSE")
         (cons 0 "INSERT")
         (cons 0 "LINE")
         (cons 0 "LWPOLYLINE")
         (cons 0 "MLINE")
         (cons 0 "MTEXT")
         (cons 0 "POLYLINE")
         (cons 0 "TEXT")
         (cons 0 "XLINE")
       (cons -4 "OR>")
   )
   )
)
(if (and eset (> (sslength eset) 0))
   (progn
   ;CHANGE COLOR FOR ALL ENTITIES
   ;Change the color
   (command "change" eset "" "Properties" "Color" clr "")   
   ;
   ;CHANGE LAYER FOR ALL ENTITIES   
   ;Change the layer
   (command "change" eset "" "Properties" "LAyer" lay "")
   )
)
(setvar "cmdecho" 1)
(princ)
)
(princ "\n Type test to run.")
(princ)
;;; ttray33y ;;;

hamidciv 发表于 2022-7-5 23:06:34

非常感谢亲爱的ttray33y很有帮助。

Tharwat 发表于 2022-7-5 23:14:52

 
@t雷,这就够了
 

(ssget '(0 . "ARC,ELLIPSE,INSERT,LINE,LWPOLYLINE,MLINE,MTEXT,,POLYLINE,TEXT,XLINE"))
页: [1]
查看完整版本: 更改属性请求