I wish to add custom properties for pline called 'doublelength'=length*2 please tell me can it be done?
![]() |
|
![]() |
|
![]() |
|
![]() |
I wish to add custom properties for pline called 'doublelength'=length*2 please tell me can it be done?
oh, you must have knowing about Xdata to do it.You can find it's infomation with Google ^^
Or use that simple example not use vla :
Code:;;;;;;;;This to get Xdata infor (defun X_DATA_GET (EN APID / EL) (setq EL (entget EN (list APID))) (cdadr (assoc -3 EL)) ;;return only data items ) ; This add extended data list DLST with ;; application name APID to the entity list ;; of entity name EN. ;; Overwrites existing. ;; (defun X_DATA_ADD (EN APID DLST / EL TMP1) (if (null (tblsearch "APPID" APID)) ;;registered? (regapp APID)) ;;register it (setq EL (entget EN) ;;get Entity list TMP1 (list -3 (cons APID DLST)) ) (if (< (xdsize TMP1) (xdroom EN)) ;;got enough room? (entmod (append EL (list TMP1)))) ;;modify database ) ;;;;;This to get Pline length (defun Length1(e) (vlax-curve-getDistAtParam e (vlax-curve-getEndParam e))) ;;Now go to use : ;Add doublelength to Pline that you select (X_data_add (setq en (car(entsel))) "Doublelength" (list (cons 1040 (* 2 (length1 en)) ))) ;Read infor later : (cdr(assoc 1040 (x_data_get (car(entsel)) "Doublelength")))
Last edited by thattinh01986; 2011-07-22 at 01:56 PM.
Not easily... it may be simpler to just get the length and multiply it by 2. Unless you are talking about adding it to the Properties palette?
If you are going to fly by the seat of your pants, expect friction burns.
Some say beauty is in the eye of the Beholder... perhaps so, but I've only seen the disintegration beam.
Everyone else being wrong is not the same thing as being right.
@dgorsman well, I want more than that. for eg I'd like to have a property called 'signal_decrease'=length*attenuation, where 'attenuation' is another property
@thattinh thanks. but I need it to change instantly, the same way 'length' does.
meaning, if I extend the pline, it automatically updates, without the need to start lisp script manually.
Tom Beauford P.S.M. - Civil 2020 on Windows 10 Enterprise
Design Analysis - Leon County Public Works/Engineering Wrap [CODE] tags around selected text
2280 Miccosukee Rd. Tallahassee, FL 32308-5310
Ph# (850)606-1516 Home Page