Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

unlocking dxf codes

9 REPLIES 9
SOLVED
Reply
Message 1 of 10
gcsjlewis
604 Views, 9 Replies

unlocking dxf codes

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?

9 REPLIES 9
Message 2 of 10
Kent1Cooper
in reply to: gcsjlewis


@gcsjlewis 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, AIA
Message 3 of 10
gcsjlewis
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.
Message 4 of 10
Kent1Cooper
in reply to: gcsjlewis


@gcsjlewis 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, AIA
Message 5 of 10
gcsjlewis
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.
Message 6 of 10
Kent1Cooper
in reply to: gcsjlewis


@gcsjlewis 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, AIA
Message 7 of 10
BlackBox_
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.



"How we think determines what we do, and what we do determines what we get."

Message 8 of 10
Kent1Cooper
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, AIA
Message 9 of 10
BlackBox_
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.



"How we think determines what we do, and what we do determines what we get."

Message 10 of 10
BlackBox_
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.

 

 



"How we think determines what we do, and what we do determines what we get."

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost