append and entmod xdata removes other xdata

append and entmod xdata removes other xdata

kpennell
Collaborator Collaborator
715 Views
2 Replies
Message 1 of 3

append and entmod xdata removes other xdata

kpennell
Collaborator
Collaborator

I'm able to add a background mask to a dimension entity using the following:

 

(setq DimEnt (car (entsel)))
(setq OldList (entget DimEnt))
(setq GetCalcDimLFac (car (cdr (assoc -3 (entget DimEnt '("ACAD_DIMASSOC_CALC_DIMLFAC"))))))
(setq GetDimLFac (car (cdr (assoc -3 (entget DimEnt '("ACAD_DIMASSOC_DIMLFAC"))))))
(setq GetOvrdeDimLFac (car (cdr (assoc -3 (entget DimEnt '("ACAD_DIMASSOC_OVERRIDDEN_DIMLFAC"))))))
(setq GetAcad (car (cdr (assoc -3 (entget DimEnt '("ACAD"))))))
(setq StartOfAcadList '("ACAD" (1000 . "DSTYLE") (1002 . "{") (1070 . 69) (1070 . 1)))
(setq EndOfAcadList (member (cons 1070 40) GetAcad))
(setq FinalAcadList (append StartOfAcadList EndOfAcadList))
(setq TheData (list (list -3 GetCalcDimLFac GetDimLFac GetOvrdeDimLFac FinalAcadList)))
(setq NewList (append OldList TheData))
(entmod NewList)

 

I'm able to turn the first extension line of the dimension off with the following:

 

(setq DimEnt (car (entsel)))
(setq oldlist (entget DimEnt))
(setq GetCalcDimLFac (car (cdr (assoc -3 (entget DimEnt '("ACAD_DIMASSOC_CALC_DIMLFAC"))))))
(setq GetDimLFac (car (cdr (assoc -3 (entget DimEnt '("ACAD_DIMASSOC_DIMLFAC"))))))
(setq GetOvrdeDimLFac (car (cdr (assoc -3 (entget DimEnt '("ACAD_DIMASSOC_OVERRIDDEN_DIMLFAC"))))))
(setq GetAcad (car (cdr (assoc -3 (entget DimEnt '("ACAD"))))))
(setq StartOfAcadList '("ACAD" (1000 . "DSTYLE") (1002 . "{") (1070 . 76) (1070 . 0) (1070 . 75) (1070 . 1)))
(setq EndOfAcadList (member (cons 1070 40) GetAcad))
(setq FinalAcadList (append StartOfAcadList EndOfAcadList))
(setq thedata (list (list -3 GetCalcDimLFac GetDimLFac GetOvrdeDimLFac FinalAcadList)))
(setq newlist (append oldlist thedata))
(entmod newlist)

 

Now, consider this workflow:

If I add the background mask, then turn off the extension line, it gets rid of the background mask.

If I turn off the extension line, then add the background mask, it turns on the extension line.

 

If I add the background mask, tweak the position in the dimension with a grip, then turn off the extension line, the background mask stays applied.

If I turn off the extension line, tweak the position in the dimension with a grip, then add the background mask, the extension line stays off.

 

Isn't this so weird?  Can anyone think of any solutions?

0 Likes
716 Views
2 Replies
Replies (2)
Message 2 of 3

CodeDing
Advisor
Advisor

@kpennell ,

 

Try these 2 lines instead:

(setpropertyvalue <entity> "Dimtfill" 1);background mask on
(setpropertyvalue <entity> "Dimse1" 1);extension line 1 off

Best,

~DD

0 Likes
Message 3 of 3

john.uhden
Mentor
Mentor

I think what you are doing is replacing the entire xdata list with just TheData.  Bear in mind that there may be many separate regapp lists within the -3 list.  When entmoding xdata you need to keep track of all the entries and either add or modify (using subst) just one entry at a time so as not to "lose" the other entries.

@CodeDing's suggestion to use ActiveX methods and properties is much cleaner when they are applicable/available.

John F. Uhden

0 Likes