Jump to content

Restore Attribute Grips.


Remenda

Recommended Posts

Can a lisp programmer review my code to find out what's not working?

This code will restore an attribute's grip when used with BricsCAD, Draftsight Professional, ZWCAD 2014, 2015, 2017.... But doesn't work in AutoCAD which is what I use most of the time. The grip apparently is controlled by LOCKED option when creating the attribute tag.

 

 

; ULMA - Work properly in ZWCAD, Draftsight, and BricsCAD...but not AutoCAD

; UnLockMyAttribute

; Steve Remenda ; July 30/2014

; July 5/2016 Tried again to get grips turned back on. no success.

; DXF code 280 lock position flag within the block reference should be 0

 

 

(defun c:ulma ( / cmd enam edat1)

(setq cmd (getvar "cmdecho"))

(setvar "cmdecho" 1)

(setq enam (car (nentsel "\nSelect Select attribute turn on grip: ")))

(setq myinsert (cdr (assoc 330 (entget enam)))) ;get the block

(setq my280 (cdr (assoc 280 (entget enam)))) ;get current 280 cons value

(if (= my280 0) ;if the attribute is locked

(progn

(setq myval 1); 1 to show grip

(setq edat1 (subst (cons 280 myval); ; Change the DXF code pair

(assoc 280 (entget enam)) (entget enam)

);subst

);setq - this does display the list and cons 280 does show a 1

(entmod edat1) ; but this returns nil. Should it?

(entupd enam) ; this should update the attribute

(entupd myinsert) ; this should update the block

 

); progn then when lock is visible

(progn ; Else attribute is something else

(initget 1 "Yes No")

(setq x (getkword "\nThis attribute grip is already on. Do you want to turn it off? (Yes or No) "))

(if (= x "Yes") ; if user wants to apply italics

(progn

(setq myval 0); 0 For No grip

(setq edat1 (subst (cons 280 myval) ; Change the DXF code pair

(assoc 280 (entget enam)) (entget enam)

); subst

); setq

(entmod edat1)

(entupd enam)

); progn to make attribute visible

); if Yes response

);progn Else attribute is something else

); if an attribute is selected.

(command "REGEN")

(setvar "cmdecho" cmd)

(princ)

) ;ulma - UnLock My Attribute

Link to comment
Share on other sites

According to the docs gc 280 can occur twice. So make sure you are changing the right one. Changing gc 70 may also be required (isReallyLocked flag?).

Alternatively use vla-put-lockposition.

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...