Axis lines when creating a new sketch

Use this space to ask how to do whatever you're trying to use SolidWorks to do.
Ben_mtl
Posts: 1
Joined: Fri Feb 02, 2024 2:21 pm
Answers: 0
x 1

Axis lines when creating a new sketch

Unread post by Ben_mtl »

Hello,
First, sorry for my English, not my 1st language.. doing my best.
I tried to find an answer to what I'm looking for but can't find anything.

So I'm kinda new to Solidworks, have been a long time Catia user but my new job uses Solidworks, I love it !
One thing I miss is how to have X and Y axis directly when I create a new sketch. Of course the origin is always there but 99% of the time I start by creating 2 axis in my new sketch. Then I take care of the dimensions from those 2 construction lines.

Is there any way to have those 2 lines already there when I create a new sketch ?

I attached a picture of what I'm looking for...
Thanks for any help !
Attachments
Capture d’écran 2024-01-31 121328.jpg
User avatar
Arthur NY
Posts: 185
Joined: Sat Mar 27, 2021 12:32 pm
Answers: 0
x 34
x 166

Re: Axis lines when creating a new sketch

Unread post by Arthur NY »

You have two options....

Option 1: Create a sketch with the two lines in it and save it as a Library file. This sketch can then be dragged into any new Part file and you're off to the races. Keep in mind that you can bring it in and leave it referencing the original or can break the link so that way it's not looking at the original sketch.

Option 2: Create the sketch and then do "File, Save As" and then change it to a "Part Template". This will then make it so that when you open anew Part file and use that template the sketch will always be there.

The second method might be preferred... and just know that just about anything can be saved into a Part, Assembly, or Drawing template.
DLZ_SWX_User
Posts: 26
Joined: Mon Dec 20, 2021 1:40 pm
Answers: 0
Location: Michigan, USA
x 112
x 11

Re: Axis lines when creating a new sketch

Unread post by DLZ_SWX_User »

Arthur NY wrote: Tue Feb 06, 2024 2:19 pm Option 2: Create the sketch and then do "File, Save As" and then change it to a "Part Template". This will then make it so that when you open anew Part file and use that template the sketch will always be there.
This is what I'd probably do. Though I have not tried it out to see how it would work with sketch I have used it to have my new part template open with some options turned off or on based on what I what to design.
User avatar
SPerman
Posts: 1834
Joined: Wed Mar 17, 2021 4:24 pm
Answers: 13
x 2014
x 1688
Contact:

Re: Axis lines when creating a new sketch

Unread post by SPerman »

My template has axes in it. I also have a macro to add them to any part/assembly file. These are not sketch axis, but the 3 primary axis that can be used on any sketch/feature. You will likely have to make some changes to the macro, as it relies on the names of the planes being consistent.
image.png
image.png (20.56 KiB) Viewed 465 times
AddAxis.swp
(64.5 KiB) Downloaded 13 times
-
I may not have gone where I intended to go, but I think I have ended up where I needed to be. -Douglas Adams
User avatar
AlexLachance
Posts: 1994
Joined: Thu Mar 11, 2021 8:14 am
Answers: 17
Location: Quebec
x 2157
x 1847

Re: Axis lines when creating a new sketch

Unread post by AlexLachance »

Hey fellow frenchie!

There's a few ways you could get what you desire but I think it would be best to know how you use these. Sorry, I've never used Catia :P

The origin could be displayed also, but that would not necessarly give you the 3 axises you desire.
Uncle_Hairball
Posts: 179
Joined: Fri Mar 19, 2021 12:21 pm
Answers: 2
x 27
x 90

Re: Axis lines when creating a new sketch

Unread post by Uncle_Hairball »

SPerman wrote: Tue Feb 06, 2024 3:58 pm My template has axes in it. I also have a macro to add them to any part/assembly file. These are not sketch axis, but the 3 primary axis that can be used on any sketch/feature. You will likely have to make some changes to the macro, as it relies on the names of the planes being consistent.

image.png

AddAxis.swp
Thanks for the helpful macro. Since I do approximately zero programming, I have a beginner-level question, if you don't mind. Can you tell me how to modify the macro to check for existing axes? The reason I need to do this is that some of our company templates have one axis and others have three, but none have no axes.
User avatar
Glenn Schroeder
Posts: 1444
Joined: Mon Mar 08, 2021 11:43 am
Answers: 22
Location: southeast Texas
x 1629
x 2044

Re: Axis lines when creating a new sketch

Unread post by Glenn Schroeder »

SPerman wrote: Tue Feb 06, 2024 3:58 pm My template has axes in it. I also have a macro to add them to any part/assembly file. These are not sketch axis, but the 3 primary axis that can be used on any sketch/feature. You will likely have to make some changes to the macro, as it relies on the names of the planes being consistent.

image.png

AddAxis.swp
I had the three primary axes in my Assembly template for years, but I only used them for Linear Patterns, so when the enhancement was added allowing us to use planes instead I deleted them.
"On the days when I keep my gratitude higher than my expectations, well, I have really good days."

Ray Wylie Hubbard in his song "Mother Blues"
Ben_mtl
Posts: 1
Joined: Fri Feb 02, 2024 2:21 pm
Answers: 0
x 1

Re: Axis lines when creating a new sketch

Unread post by Ben_mtl »

Thanks a lot for those suggestions. I looked at them and the solution was super easy : a macro !

So I selected a plane first, then started recording what I wanted to do : clic "sketch button", create 2 lines (vertical + horizontal), job's done !

Created a "new" icon to use the macro just beside the usual sketch button.
Capture d’écran 2024-02-07 102449.jpg
Capture d’écran 2024-02-07 102449.jpg (10.33 KiB) Viewed 354 times
When you click the button the macro starts.

And you end up in the exact situation as my picture in the first post : sketch mode in the selected plane (or surface), 2 lines already drawn, it's your turn to take the mouse !
Capture d’écran 2024-01-31 121328.jpg


Here is the code:
Dim swApp As Object

Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long

Sub main()

Set swApp = Application.SldWorks

Set Part = swApp.ActiveDoc
Part.SketchManager.InsertSketch True
Part.ClearSelection2 True
Dim skSegment As Object
Set skSegment = Part.SketchManager.CreateCenterLine(0#, 0.04014, 0#, 0#, 0#, 0#)
Set skSegment = Part.SketchManager.CreateCenterLine(0#, 0#, 0#, 0.038859, 0#, 0#)
Part.SetPickMode
Part.ClearSelection2 True
End Sub


I have to see how I can modify the code so it also works if I have no surface/plane selected when clicking the button (the script would asks me for a plane/surface before "clicking" the sketch button), but I'm already super happy with that.

Thanks again !
User avatar
Dwight
Posts: 231
Joined: Thu Mar 18, 2021 7:02 am
Answers: 2
x 2
x 191

Re: Axis lines when creating a new sketch

Unread post by Dwight »

Try making the 3 main planes show (not hidden) and dimension to those. That will work in most situations for what you want to do. I try to dimension to main planes in sketches whenever possible. You can always hide the main planes later, if you don't want them to show in the model.

I do leave the main planes hidden all the time, but select them in the tree when I dimension to them.

Dwight
User avatar
SPerman
Posts: 1834
Joined: Wed Mar 17, 2021 4:24 pm
Answers: 13
x 2014
x 1688
Contact:

Re: Axis lines when creating a new sketch

Unread post by SPerman »

Glenn Schroeder wrote: Wed Feb 07, 2024 8:46 am I had the three primary axes in my Assembly template for years, but I only used them for Linear Patterns, so when the enhancement was added allowing us to use planes instead I deleted them.
I use them on every part I draw, but I come from NX where coordinate systems were real and powerful tools. Axis are as much a part of my modeling as planes are.
-
I may not have gone where I intended to go, but I think I have ended up where I needed to be. -Douglas Adams
User avatar
DanPihlaja
Posts: 747
Joined: Thu Mar 11, 2021 9:33 am
Answers: 24
Location: Traverse City, MI
x 738
x 893

Re: Axis lines when creating a new sketch

Unread post by DanPihlaja »

You cold just add a coordinate system to your template. It works just as well and is 1 item.
-Dan Pihlaja
Solidworks 2022 SP4

2 Corinthians 13:14
User avatar
SPerman
Posts: 1834
Joined: Wed Mar 17, 2021 4:24 pm
Answers: 13
x 2014
x 1688
Contact:

Re: Axis lines when creating a new sketch

Unread post by SPerman »

That may be true in 2024, but in 2017, when I started, coordinate systems were all but useless. I had one in my template, before I figured out I couldn't use it's planes or axes.
-
I may not have gone where I intended to go, but I think I have ended up where I needed to be. -Douglas Adams
User avatar
DanPihlaja
Posts: 747
Joined: Thu Mar 11, 2021 9:33 am
Answers: 24
Location: Traverse City, MI
x 738
x 893

Re: Axis lines when creating a new sketch

Unread post by DanPihlaja »

SPerman wrote: Wed Feb 07, 2024 1:05 pm That may be true in 2024, but in 2017, when I started, coordinate systems were all but useless. I had one in my template, before I figured out I couldn't use it's planes or axes.
Yes that's true. It needs to be SW 2022 or later.
-Dan Pihlaja
Solidworks 2022 SP4

2 Corinthians 13:14
User avatar
SPerman
Posts: 1834
Joined: Wed Mar 17, 2021 4:24 pm
Answers: 13
x 2014
x 1688
Contact:

Re: Axis lines when creating a new sketch

Unread post by SPerman »

Even in 2022, the CS isn't as useful as it could be. There is no way to select the planes or axes via the history tree.
-
I may not have gone where I intended to go, but I think I have ended up where I needed to be. -Douglas Adams
Post Reply