Jump to content
jt6572

CUI - overriding default function keys

Recommended Posts

jt6572

hi All, 

Im sorry if this has been posted a billion times, but I am on a tight schedule atm. 

 

Im having trouble reassigning the F4 and F5 keys. I like to have them override the end and intersection snaps respectively. I have edited the CUI as below but pressing F4 still just fires 3DOSnap. 

 

would really appreciate help on this as I use it all the time to zoom to an object in MS to have it scale and position correctly in PS. 

 

thank you :) 

 

UlRtRcY.png

Share this post


Link to post
Share on other sites
rkmcswain

Do you have any additional keyboard shortcuts defined in any partial customization files? (that last [+].....)

Share this post


Link to post
Share on other sites
jt6572

hi rkmcswain

 

thanks very much for your reply. I do have them set in there, but dont remember putting them in (ie; I am back using autoCAD after suffering through Microstation). Interesting they are set to what I want them to be.... 

just a quick question if that's okay? I am correct in thinking that i will be able to press F4 to snap to an endpoint when doing a zoom window, right? 

 

9DS5R0v.png

Share this post


Link to post
Share on other sites
tombu

Haven't tried it but by default zoom window ignores Object Snap mode settings. 

You can still tell it to snap to each endpoint after starting the command but you would probably need a lisp routine to do what you want.

Without seeing your macro F3 already toggles OSNAP and SHIFT+E toggles Endpoint snap.

Share this post


Link to post
Share on other sites
jt6572

Hi Tombu

Thanks for your reply. :)

I've used autocad for quite a few years, so no probs with understanding snap modes. A Couple of years ago since I used it, but I am sure I had the frame for a viewport set in ms and after the zoom command, pressing F4 did snap to the endpoints so the scale, position and size were perfect. 

 

Whether I am hallucinating or not, pressing F4 will always only fire the 3DOSnap command. At least if I can change the command of the funkey i will know if it will actually work or not!  

Share this post


Link to post
Share on other sites
tombu

Can't actually see the macro you're trying to assign to (Key Down) for F4, what is it?

You could use a macro or lisp for Zoom  like Zoom Window endp pausing for point selection endp

 

If you get it working post how you did it.

Share this post


Link to post
Share on other sites
jt6572

Hey Tombu, 

I really think it is just a matter of remapping the F4 key. 

 

so first question is, why can't I overwrite the default setting!

second question is: is this actually possible (zoom, snap) or have I gone prematurely senile?!! 🙃

Share this post


Link to post
Share on other sites
tombu

Old Lee Mac lisp solution: 

 

  • Like 1

Share this post


Link to post
Share on other sites
jt6572

hey Tombu, 

that's awesome! thanks so much - i really appreciate it. :)

 

only just got in, so will try it out. I had thought that maybe just a zoom to object would work as well, as it is the viewport frame I scale and bring into model space. will report back on both soon. 

 

The shizzle: 

 

(defun c:zw ()
   (setq pt1 (getpoint "\nSelect First Window Point: "))
   (setq pt1 (osnap pt1 "_endp"))
   (setq pt2 (getpoint "\nSelect Second Window Point: "))
   (setq pt2 (osnap pt2 "_endp"))
     (command "zoom"
     "w"
   pt1
   pt2
     ) ; end zoom
    (princ)
) ; end program

 

Edited by jt6572
add outcome

Share this post


Link to post
Share on other sites
tombu
12 hours ago, jt6572 said:

I had thought that maybe just a zoom to object would work as well, as it is the viewport frame I scale and bring into model space. will report back on both soon. 

You convinced me to add it to my Zoom drop-down in my custom View panel using the default Rectangle Images. ZW is a defined shortcut for "Zoom Window" in Civil 3D so I named it "Zoom to Points" or ZPTS.

 

Lee's code was conceptual and didn't use local variables, he suggested using CAB's version in the thread. I went with CAB's version but commented out the OSNAP lines letting "getpoint" use my OSNAP settings.

(defun c:zpts (/ pt1 pt2)
(if
  (and
   (setq pt1 (getpoint "\nSelect First Window Point: "))
;   (setq pt1 (osnap pt1 "_end,_app"))
   (setq pt2 (getpoint "\nSelect Second Window Point: "))
;   (setq pt2 (osnap pt2 "_end,_app"))
  )
   (command "._zoom" "_w" "_non" pt1 "_non" pt2) ; end zoom
)
(princ)
)

Curious what you're trying to do here with the viewport frame. There are a few lisp for creating them like https://jtbworld.com/autocad-vp-outline-lsp. Are you trying to match a viewport's view on the Model tab? Saving that view and restoring it on the Model tab is easy enough and switching between multiple saved views is as simple as picking them from a drop-down.

  • Like 1

Share this post


Link to post
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
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

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