Visual LISP, AutoLISP and General Customization

Reply
Distinguished Contributor
Posts: 108
Registered: ‎11-07-2012
Message 1 of 10 (187 Views)
Accepted Solution

unlocking dxf codes

187 Views, 9 Replies
05-15-2013 04:48 AM

I am trying to change a viewport scale through the dxf code:  I see that certain parts cannot be changed but I don't know if this is one of them.  Here's what I have so far:

 

(defun c:vps ()

(setq quickview (entget(car(entsel))))

 (setq g45 (cdr(assoc 45 quickview))) 

(setq g41  (cdr(assoc 41 quickview)))

 (setq new1 (* g45 1.5)) 

(entmod (subst (cons 41 new1) (assoc 41 quickview) quickview))

 )

The scale is a ratio between m-space height & p-space height.  So if I want all viewports to be 1:1.5 scale this is what I need to do, but my entmod command isn't working is there another way?

*Expert Elite*
Kent1Cooper
Posts: 4,968
Registered: ‎09-13-2004
Message 2 of 10 (180 Views)

Re: unlocking dxf codes

05-15-2013 06:10 AM in reply to: manamalewis

manamalewis wrote:

I am trying to change a viewport scale through the dxf code:  I see that certain parts cannot be changed but I don't know if this is one of them. ....


Neither the Height nor CustomScale VLA Properties show as Read-Only, so they should be changeable, but Is the Viewport locked?  If so, try first removing the 16384 bit from the (assoc 90) value in the entity data, or changing the DisplayLocked VLA Property from -1 to 0, then substitute the (assoc 41) value or assign a CustomScale VLA Property of [I'd have to think about whether 2/3 or 3/2, but you can find out easily enough by trying them both].  And presumably you'd want to then re-lock the Viewport by reversing what you did to unlock it.

Kent Cooper
Distinguished Contributor
Posts: 108
Registered: ‎11-07-2012
Message 3 of 10 (174 Views)

Re: unlocking dxf codes

05-15-2013 06:18 AM in reply to: Kent1Cooper
Viewport is unlocked. I have "(90 . 33344)". What does this actually do?



________________________________
The information contained in this message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately, and delete the original message.
*Expert Elite*
Kent1Cooper
Posts: 4,968
Registered: ‎09-13-2004
Message 4 of 10 (165 Views)

Re: unlocking dxf codes

05-15-2013 08:13 AM in reply to: manamalewis

manamalewis wrote:
Viewport is unlocked. I have "(90 . 33344)". What does this actually do?

The red ones below add up to 33344, so they would be the status characteristics of the Viewport.

 

90 Viewport status bit-coded flags:

1 (0x1) = Enables perspective mode

2 (0x2) = Enables front clipping

4 (0x4) = Enables back clipping

8 (0x8) = Enables UCS follow

16 (0x10) = Enables front clip not at eye

32 (0x20) = Enables UCS icon visibility

64 (0x40) = Enables UCS icon at origin

128 (0x80) = Enables fast zoom

256 (0x100) = Enables snap mode

512 (0x200) = Enables grid mode

1024 (0x400) = Enables isometric snap style

2048 (0x800) = Enables hide plot mode

4096 (0x1000) = kIsoPairTop. If set and kIsoPairRight is not set, then

isopair top is enabled. If both kIsoPairTop and kIsoPairRight are set,

then isopair left is enabled

8192 (0x2000) = kIsoPairRight. If set and kIsoPairTop is not set, then

isopair right is enabled

16384 (0x4000) = Enables viewport zoom locking

32768 (0x8000) = Currently always enabled

65536 (0x10000) = Enables non-rectangular clipping

131072 (0x20000) = Turns the viewport off

 

I don't have any other bright ideas about why you can't change it as you want, but if I think of anything, I'll write back.

Kent Cooper
Distinguished Contributor
Posts: 108
Registered: ‎11-07-2012
Message 5 of 10 (159 Views)

Re: unlocking dxf codes

05-15-2013 08:31 AM in reply to: Kent1Cooper
Thanks. Yeah just doing research I saw that "entmod" cannot be used with viewport dxf codes

________________________________
The information contained in this message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately, and delete the original message.
*Expert Elite*
Kent1Cooper
Posts: 4,968
Registered: ‎09-13-2004
Message 6 of 10 (155 Views)

Re: unlocking dxf codes

05-15-2013 09:07 AM in reply to: manamalewis

manamalewis wrote:
Thanks. Yeah just doing research I saw that "entmod" cannot be used with viewport dxf codes

This seems to work, even if the Viewport is locked:

 

(setq vpobj (vlax-ename->vla-object (car (entsel "\nSelect Viewport: "))))

(vla-put-CustomScale vpobj (/ 2.0 3))

.... or maybe you need it to be:

(vla-put-CustomScale vpobj (/ 3.0 2))

Kent Cooper
Distinguished Mentor
BlackBox_
Posts: 701
Registered: ‎02-25-2013
Message 7 of 10 (142 Views)

Re: unlocking dxf codes

05-15-2013 01:28 PM in reply to: Kent1Cooper

Just be mindful that the ActiveViewport Property Object must be 'put' back to the Document Object before changes made to same are visible.



"Potential has a shelf life." - Margaret Atwood


Autodesk Exchange Apps ~ Autoloader ~ AutoCAD Security

*Expert Elite*
Kent1Cooper
Posts: 4,968
Registered: ‎09-13-2004
Message 8 of 10 (139 Views)

Re: unlocking dxf codes

05-15-2013 01:37 PM in reply to: BlackBox_

BlackBoxCAD wrote:

Just be mindful that the ActiveViewport Property Object must be 'put' back to the Document Object before changes made to same are visible.


Not for me.  I just tried it again, in two different drawings, and changes were visible immediately.  [ADT2004 if it makes any difference.]

Kent Cooper
Distinguished Mentor
BlackBox_
Posts: 701
Registered: ‎02-25-2013
Message 9 of 10 (133 Views)

Re: unlocking dxf codes

05-15-2013 02:20 PM in reply to: Kent1Cooper

Kent1Cooper wrote:

BlackBoxCAD wrote:

Just be mindful that the ActiveViewport Property Object must be 'put' back to the Document Object before changes made to same are visible.


Not for me.  I just tried it again, in two different drawings, and changes were visible immediately.  [ADT2004 if it makes any difference.]


Change the Target.



"Potential has a shelf life." - Margaret Atwood


Autodesk Exchange Apps ~ Autoloader ~ AutoCAD Security

Distinguished Mentor
BlackBox_
Posts: 701
Registered: ‎02-25-2013
Message 10 of 10 (129 Views)

Re: unlocking dxf codes

05-15-2013 02:47 PM in reply to: BlackBox_

BlackBoxCAD wrote:

Kent1Cooper wrote:

BlackBoxCAD wrote:

Just be mindful that the ActiveViewport Property Object must be 'put' back to the Document Object before changes made to same are visible.


Not for me.  I just tried it again, in two different drawings, and changes were visible immediately.  [ADT2004 if it makes any difference.]


Change the Target.


FWIW - Here's a recent example of the Target issue requiring to be 'put' back.

 

 



"Potential has a shelf life." - Margaret Atwood


Autodesk Exchange Apps ~ Autoloader ~ AutoCAD Security

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Welcome to the new Autodesk Community!
If this is your first visit, click here to get started and make the most of the Community. Let us know what you think of the new experience in the Community Feedback Forum.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community