Community
Civil 3D Customization
Welcome to Autodesk’s AutoCAD Civil 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Civil 3D Customization topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Creating commands/buttons for OSNAPS

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
jhfoat
262 Views, 5 Replies

Creating commands/buttons for OSNAPS

Civil 3D 2018. Looking for any input on the title of post. My snaps reset every time I use certain line commands (line by bearing). I've seen this is a common problem with no apparent fixes. I'm not extremely familiar with Lisp writing/coding. I know how to load then using the appload command and what not. I'm just looking for a way to either create a button/icon, or create a keyboard command, in civil that I can quickly click just to activate endpoint and node. Use those the most. I've been messing with the CUI interface to no prevail. Any help is greatly appreciated, almost always find the help I am looking for on these forums. Thanks.

5 REPLIES 5
Message 2 of 6
hippe013
in reply to: jhfoat

Some commands disable the running snaps and pretty much force the user to specify a snap for the point that is being prompted. This, for most part, is by design. More information on snaps can be found here:

AutoCAD 2022 Help | About Using Object Snaps | Autodesk

 

Setting your snaps via Lisp is very easy. You just need to set the OSMODE system variable. Here is an example code that sets the snaps to End, Middle, and Node. Which is 1 (end) + 2 (midpoint) + 8 (Node) = 11. 

 

(defun c:MYSnapMode ()
   (setvar "OSMODE" 11)
   (princ "\nSnap mode has been set to End, Mid, & Node.")
   (princ)
 )

 More information on OSMODE can be found here: 

AutoCAD 2022 Help | OSMODE (System Variable) | Autodesk

 

Message 3 of 6
jhfoat
in reply to: jhfoat

How do I go about making a shortcut for that LISP once I have it loaded? I'm a surveyor and use bearing line command quite often. I'm looking for a fast way to just hit a key for a command or create a button to just turn my osmode back on.

 

Message 4 of 6
hippe013
in reply to: jhfoat

How are you invoking the line by Bearing Distance command? Are you clicking a button? or starting the line command and then entering 'BD (transparent command)?

 

In the version that I am using (Civil 3D 2024) the snaps are not affected when starting the line by bearing command.  

 

Either way, you can use the example code transparently. Type apostrophe and then the command name. 

For example: 'MySnapMode

That will set the snaps while the command is running. 

Message 5 of 6
jhfoat
in reply to: jhfoat

I click the line button/icon and hit bearing distance for my line usually. That lisp worked and is making the osnaps stay on for now.. Is there a way to make a button for my toolbar that I could click to turn it on also? Thanks by the way. Just saves a little bit of time. Maybe they fixed it turning the snaps off in 2024.. I know it's been an issue for sometime now.

Message 6 of 6
hippe013
in reply to: jhfoat


@jhfoat wrote:

Is there a way to make a button for my toolbar that I could click to turn it on also? 


Yeah. You can use the CUI command to add and customize toolbars.

 

My preference is to type commands in rather than using buttons, so I am not the best source for information regarding adding new buttons or toolbars. 

 

hippe013_0-1717622937123.png

 

hippe013_1-1717623019626.png

 

Play with it and see how it works. 

 

 

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

Post to forums  

Rail Community


 

Autodesk Design & Make Report