Jump to content
Remenda

Restore Attribute Grips.

Recommended Posts

Remenda

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

Share this post


Link to post
Share on other sites
Roy_043

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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×