I'm wanting to do an entity update on an entity that has had its 340. <Ent .. > changed ...
no joy so far
and I'm wondering if I've missed something ( ie : it can't be done
)
With Mechanical2007
i'm trying to replace the description in a Part Reference marker
(defun c:MATLReplace (/ eko)
(setq eko (getvar "cmdecho"))
(setvar "cmdecho" 0)
(if (setq tmp
(kdub:objsel "Select Material Marker entity" (list "ACMPARTREF") nil)
)
(progn (setq *lent* (entget (car tmp))
*lent340* (entget (cdr (assoc 340 *lent*)))
)
(if (setq index (vl-position '(1 . "DESCR") *lent340*))
(progn (setq *lent340* (kdub:replaceItemInList *lent340*
(1+ index)
(cons 2 "New Description")
)
)
(entmod *lent340*)
(entmod *lent*)
)
)
)
)
(setvar "cmdecho" eko)
(princ)
)
The datalist is being changed sucessfully, but the entity is returning nil from the entmod function.
here's what should be hapenning
Select a Marker.
Retrieve the marker entity Data
Retrieve the 340.entity from the Data
Find the index of the cons item to replace.
Replace the cons list.
entmod the 340.entity.
entmod the marker entity.
The data looks like this :-
((-1 . <Entity name: 7edae010>) (0 . "ACMPARTREF")
(5 . "412")
(102 . "{ACAD_REACTORS")
(330 . <Entity name: 7efdffb8>)
(102 . "}")
(330 . <Entity name: 7efddcf8>)
(100 . "AcDbEntity")
(67 . 0)
(410 . "Model")
(8 . "AM_12")
(100 . "AcmSymbolClass")
(10 541.082 134.228 0.0)
(11 1.0 0.0 0.0)
(12 0.0 1.0 0.0)
(40 . 10.0)
(1 . "ISO")
(100 . "AcmPartRef")
(340 . <Entity name: 7efdffb8>) <<-- this is the entity reference I'm changing
(280 . 1)
(340 . <Entity name: 7edae008>)
)
((-1 . <Entity name: 7efdffb8>) (0 . "ACMDATAENTRYPART")
(5 . "40F")
(102 . "{ACAD_REACTORS")
(330 . <Entity name: 7efdf440>)
(102 . "}")
(330 . <Entity name: 7efdf440>)
(100 . "AcmDataEntry")
(90 . 2)
(90 . 5)
(1 . "BOM_UNITS")
(2 . "ea")
(3 . "")
(1 . "DESCR")
(2 . "150 UB 14")
(3 . "")
(1 . "STANDARD")
(2 . "1000")
(3 . "")
(1 . "MATERIAL")
(2 . "300PLUS")
(3 . "")
(1 . "MASS")
(2 . "14.0")
(3 . "")
(90 . 1)
(10 0.0 0.0 0.0)
< trim>)
The revised 340.entity data updates correctly, and looks like this :-
((-1 . <Entity name: 7efdffb8>) (0 . "ACMDATAENTRYPART")
(5 . "40F")
(102 . "{ACAD_REACTORS")
(330 . <Entity name: 7efdf440>)
(102 . "}")
(330 . <Entity name: 7efdf440>)
(100 . "AcmDataEntry")
(90 . 2)
(90 . 5)
(1 . "BOM_UNITS")
(2 . "ea")
(3 . "")
(1 . "DESCR")
(2 . "New Description")
(3 . "")
(1 . "STANDARD")
(2 . "1000")
(3 . "")
(1 . "MATERIAL")
(2 . "300PLUS")
(3 . "")
(1 . "MASS")
(2 . "14.0")
(3 . "")
(90 . 1)
(10 0.0 0.0 0.0)
< trim>)
any ideas ?
I may need to go the ActiveX(COM) route, but in the mean time this problem has me entranced ...