Jump to content

entmod not working when removing assoc?


Jef!

Recommended Posts

Lets say I have a line.

Color dxf group code is 62, and does not exist when the color is "by layer". If I put the color to red and run that

(defun c:VirtualLiquidPaper ( / )
  (setq tmp (entget (car(entsel))))
  (if (assoc 62 tmp)
      (entmod (setq tmp (vl-remove (assoc 62 tmp) tmp)))
  )
)

I see that tmp's value get updated, and the assoc 62 get removed from the list, but to my big surprise the entity don't get updated. What did I miss?

 

 

** I even tried to add directly after defun (shake-well-com).. not worky** :D

Link to comment
Share on other sites

(defun c:FOO (/ eName eData color)
 (if
   (and
     (setq eName (car (entsel)))
     (setq color (assoc 62 (setq eData (entget eName))))
   )
    (entmod (subst (cons 62 1) color eData))
 )
 (princ)
)

Link to comment
Share on other sites

Thanks BlackBox... still not what I need tho =)

I want to put it "by layer", that's why I'm trying to entmod with the elist after removing the assoc 62.

Link to comment
Share on other sites

Thanks BlackBox... still not what I need tho =)

I want to put it "by layer", that's why I'm trying to entmod with the elist after removing the assoc 62.

 

You don't need to remove the 62 grouped pair, you need only SUBSTitute it:

 

(defun c:FOO (/ eName eData color)
 (if
   (and
     (setq eName (car (entsel)))
     (setq color (assoc 62 (setq eData (entget eName))))
   )
    (entmod (subst (cons 62 [color="red"]256[/color]) color eData))
 )
 (princ)
)

 

 

 

... Or perhaps:

 

(command "._setbylayer")

Link to comment
Share on other sites

found a way

(defun c:FOO (/ eName eData color)
 (if
   (and
     (setq eName (car (entsel)))
     (setq color (assoc 62 (setq eData (entget eName))))
   )
    (entmod (subst (cons 62 [b]256[/b]) color eData))
 )
 (princ)
)

After that (entget(car(entsel))) returns the list without any assoc 62.

Select object: ((-1 . ) (0 . "LINE") (330 . ) (5 . "8033F") (100 . "AcDbEntity") (67 . 1) (410 . "XX") (8 . "DIM") (100 . "AcDbLine") (10 75.7625 32.3625 0.0) (11 81.2034 32.7837 0.0) (210 0.0 0.0 1.0))

 

 

Funny but worky =)

thanks

edit: you were faster than me.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...