The H-Factor

My Photo
HLogo

July 2019

Sun Mon Tue Wed Thu Fri Sat
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      

« Another Way of Setting Favorites in HydraLIST | Main | Upgrading my Machine from XP to Windows 7 64-bit »

November 24, 2010

Comments

James Litvak

I've had trouble with my osnaps getting overridden since I started using HydraCAD 6 years ago. At first I would go into the Drawing Settings (DS) and reselect the osnaps I use every time. I eventually learned of a command to set osnaps without having to open the Drawing Settings dialog. It is called OSMODE. The command is entered followed by a number that determines which osnaps are selected. The individual indentifier for each osnap is available in the help file. The number for each desired osnap is added and the sum is entered after OSMODE. To further this solution, I made a shortcut key with the macro "OSMODE ##". For my own purposes, I use endpoint, midpoint, insertion, center, and node, which is OSMODE 47. I've mapped it to the shortcut key combination CTRL+R. So now, whenever I find that my osnaps have been turned off, or changed, I type CTRL+R and they all come right back. I've actually made the macro "^POSMODE 47" so that way it cancels out of any active command and then resets my osnaps. I've found this to be incredibly helpful.

Fprandy

I have created a very similar routine using OSMODE, for my purposes, I mapped osnaps to the number keypad using transparent modifiers. Using this method I'm able to change or cancel osnaps on the fly without canceling my durrent command.

James Litvak

Would you mind explaining how to use a transparent modifier? I used to have a lsp file that would make '' (apostrophe apostrophe) be my mid-command command for "mid between two points" but for some reason it doesn't work anymore on AutoCAD 2011.

Fprandy

I created this a while back with an earlier version of Autocad, with the use of the .mns file, which are no longer in use, but can ?? be brought into newer versions of Autocad.

I did a search on my computer and found the .mns file that contained text for these commands.

***ACCELERATORS
["NUMPAD5"]'_osmode;4;
["NUMPAD1"]'_osmode;1;
["NUMPAD0"]'_osmode;0;
["NUMPAD2"]'_osmode;2048;
["NUMPAD7"]'_osmode;32;
["NUMPAD4"]'_osmode;2;
["NUMPAD3"]'_osmode;512;
["NUMPAD6"]'_osmode;16;
["NUMPAD8"]'_osmode;65;
["NUMPAD9"]'_osmode;128;

I hope this information in some way helps you. I'm not knowledgeable in programming or .lisp and it's entirely possible this will not work in 2011.


Art

Randy - Yes that will work. You can also bring it in as a partial CUI and transfer the keyboard shortcut to our full menu!

MAXIMUS Bradley

I have used AutoCad fo a loong time and I don't really find HydraCad snaps useful for me.
I use Razer Naga Mouse and made a macro turning on the snaps I need in order to deal with this little annoyance:
OSMODE [spacebar] 163 [enter] It helps me dimension the drawing to get it ready for the foreman.

163 is the sum for the following snaps: Endpoint, Midpoint, Intersection and Perpendicular.
Link below shows the numerical value corresponding to the osnaps.
http://docs.autodesk.com/ACD/2010/ENU/AutoCAD%202010%20User%20Documentation/index.html?url=WS1a9193826455f5ffa23ce210c4a30acaf-4f1d.htm,topicNumber=d0e352473

Iamjamieq

Interestingly, I came to this blog post today and saw my comments above (James Litvak, I just can't access that account now). I've been using the Ctrl+R keyboard shortcut to reset my Osnaps for years. However, having recently switched back to HydraCAD after years of using SprinkCAD, and also having learned LISP programming, and wrote dozens of my own programs, I've noticed that HydraCAD has a huge deficiency with error handling. For example, today I was looking through Sprnks.lsp and noticed that one function (can't remember which, but I believe it was INS_HEAD) calls (c:sos) which saves the current osmode, (os0) which sets osmode to 0, and (c:ROS) which returns the saved osmode. However, if an error occurs between a call of (os0) and (c:ROS), then osmode stays at 0. There should be an error handler that also calls (c:ROS) for such a case. In fact, every function that is only supposed to temporarily change a variable should have an error handler to return the variable if the final return call isn't received. I added my own error handler to the function in question by adding a local variable *error* and simply adding the following right after the function definition:

(defun *error* (errmsg)
(c:ROS)
)

Now it restores my osmode always. I'll be looking through the other lsp files tomorrow to see where I can add error handlers. Osnaps always being changed was one of my biggest pet peeves years ago when I previously used HydraCAD, and it is something that really should have been solved by now. I ask that you please look through your code and add error handlers. I can help if you would like.

James Litvak

Looks like I got my login back.

Anyway, I also noticed that the INS_HEAD function also fails to turn off ORTHOMODE if it was off prior to the command. You need to add in a symbol to save orthomode status, and another to save polar mode status, for example (setq opolar (boole 1 8 (getvar 'AUTOSNAP))). Then reset both at the end of the function and also include an error handler.

You can reset polar mode like this:

(if (= opolar 0)(setvar 'AUTOSNAP (boole 4 8 (getvar 'AUTOSNAP)))(setvar 'AUTOSNAP (boole 7 8 (getvar 'AUTOSNAP))))

It is very frustrating that HydraCAD keeps dictating my object snaps and other/polar status.

Art

James - You can turn off our control of osnaps completely. That option is specified in this blog post.

Arthur Dove

This has been completed for the next update (V56.04, V55.05)

All these items, including OSMODE, ORTHOMODE, EXPERT, AUTOSNAP and PICKBOX, will be restored to previous settings if a command encounters an error. If any slip through the cracks, please let me know.

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been saved. Comments are moderated and will not appear until approved by the author. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment

Comments are moderated, and will not appear until the author has approved them.

Your Information

(Name is required. Email address will not be displayed with the comment.)