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.
Solved! Go to Solution.
Solved by hippe013. Go to Solution.
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
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.
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.
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.
@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.
Play with it and see how it works.
Well, here is my way via Autolisp that is crude, but works very well.
Save code as a single lisp and have fun. I have been using these for years and rarely cough's with other
commands in C3D native commands or functions. It isn't for everyone, but some might find that doing what we have to do thousands of times a day it might make some sense. MJP
In addition if you use the transparent command ' in front of the "1" [enter] it will be a transparent "endpoint" command. What that means is you can start the line command and you have picked a couple of endpoints you can then midstream change to node mode. Eg:
Start a line with endpoint
L1 hit a couple of connections then type
'3 and it changes to snap node mode on the fly.
If you look at all the options I have created you can save time with these basic Hacks.
of course you can modify osmode to whatever combination of snaps you want to hold like did with:
4 [ENTER]
set osmode 237 end point node intersection perpendicular
(defun c:1 ();set osmode off endpoint midpoint
(setvar "cmdecho" 0)
(setvar "osmode" 3)
(setvar "cmdecho" 0)(prompt "\snap= endpoint midpoint")
(princ)
)
Can't find what you're looking for? Ask the community or share your knowledge.