SOLIDWORKS API for the Total Beginner - 5/6 Creating a Drawing ua-cam.com/video/KbZnKfZdbQQ/v-deo.html 11:43 dfrns btwn , dim swap as sldw and set swap = aplcsh 13:24 api help > index > stndrd view 32:26 supprt in vsul wndo :
I followed through your code until 16:50, but somehow it doesn't create the 3rd angle view. No errors whatsoever. When I ran the macro, seems like it stop at "swDraw = swModel" because drawing sheet is open.
It appears that the macro is intended to open the drawing, not work with an already open one. A more robust code would have logic included that would either warn the user that the drawing is already open, or would modify the approach based on if the model is currently open. At this very early stage of the project you will have to make sure the starting conditions are met, and add complexity over time.
You have a couple of options. Ideally you would open the drawing template (File > Open > File Type = Templates, open the specified/default template) and change the units there, save it, and then all future drawings would retain those values. It should also be possible to change the document units but you would just have to find the command to do it.
Hi Keith , I have got an error in the Create3rdAngleViews2 line... It says that the object variable or with block variable is not set... Please help me with this
When debugging it should highlight the line you are working on. Double check that all arguments are there, no extra spaces or incorrect punctuation, and if needed try recreating that line to see if that resolves the issue. Refer to the documentation for additional details about what variables are allowed for that command.
@19ME021 MANOJ KUMAR P I am attempting the same and get the same issue on this line. When I check what swModel is now set equal to, it states it is set equal to nothing. Do you think that could be the cause of the issue?
In the line where you wrote the drawing path, dont forget to put .(SLDDRW) at the end, even if your file name dont have it. I know it does not make scence, but i tried it, and it works!
I am getting the same error and after reading the below comments. I have tried the work arounds but didn't helped. Can you please help @MLC CAD Systems.
Thank you for the video, would you mind giving us some advice, how come my Index search for API help does not have anything that shows as the video shown? do I need to update to help? and how?
I know this was a while ago but I encountered a similar issue while watching these videos. I realized I was opening the help section from the VB Editor rather than the API help from inside solidworks, and that they show different content
Yes, if you can do it with a mouse and a keyboard it is almost certainly possible with the API. If you watch the entire series of videos you'll see how to find the command and structure the code.
Thanks for sharing the information. Your video is blurry in between. So I could not read the video content in between. Example: 5:16, 19:26, I crosschecked it in different browsers. Still, it is the same blurry image in a video. So we could not follow. Appreciate your effort in sharing the information.
Sorry about that, this video wasn't recorded in full HD because it is much older but is still a great introduction to the workflow of programming. I'm glad you appreciate the content, if you want more like this you can also check out CADSharp.com.
Unfortunately, we do not have a copy of the finished code. The video is supplied as educational only. Similar code can be found online and in the help documentation.
For API support you will get best results by going direct to your Reseller, SOLIDWORKS, or an API forum online. You can also check out www.cadsharp.com/ which is Keith's company, he was a featured guest on our channel for this video series.
We're happy to discuss it, you can reach out with your contact information at www.mlc-cad.com/contact-us/ or reach out to CAD Sharp at www.cadsharp.com/, they are the ones we collaborated with for this particular event and they have a lot of on-demand content.
Hi, thank you for the informative series. How can I choose drawing view 3 to add the dimensions? I changed the line: swModel.Extension.SelectByID2 "Drawing View1", "DRAWINGVIEW", 0, 0, 0, False, 0, Nothing, 0 to: swModel.Extension.SelectByID2 "Drawing View3", "DRAWINGVIEW", 0, 0, 0, False, 0, Nothing, 0 The result is the same, even if I try to activate the view: swDraw.ActivateView "Drawing View3" Thank you.
I recommend reaching out to the community for support learning how to use and develop with the API. The SOLIDWORKS Forum forum.solidworks.com/ or the Reddit SOLIDWORKS community www.reddit.com/r/SolidWorks/ should be able to assist.
SOLIDWORKS API for the Total Beginner - 5/6 Creating a Drawing
ua-cam.com/video/KbZnKfZdbQQ/v-deo.html
11:43 dfrns btwn , dim swap as sldw and set swap = aplcsh
13:24 api help > index > stndrd view
32:26 supprt in vsul wndo :
I followed through your code until 16:50, but somehow it doesn't create the 3rd angle view. No errors whatsoever. When I ran the macro, seems like it stop at "swDraw = swModel" because drawing sheet is open.
It appears that the macro is intended to open the drawing, not work with an already open one. A more robust code would have logic included that would either warn the user that the drawing is already open, or would modify the approach based on if the model is currently open. At this very early stage of the project you will have to make sure the starting conditions are met, and add complexity over time.
Hi. The dimension which were automatically added are in Meters on my drawing. is there a way to convert them in mm inside the macro?
You have a couple of options. Ideally you would open the drawing template (File > Open > File Type = Templates, open the specified/default template) and change the units there, save it, and then all future drawings would retain those values. It should also be possible to change the document units but you would just have to find the command to do it.
Hi Keith , I have got an error in the Create3rdAngleViews2 line... It says that the object variable or with block variable is not set... Please help me with this
When debugging it should highlight the line you are working on. Double check that all arguments are there, no extra spaces or incorrect punctuation, and if needed try recreating that line to see if that resolves the issue. Refer to the documentation for additional details about what variables are allowed for that command.
@19ME021 MANOJ KUMAR P I am attempting the same and get the same issue on this line. When I check what swModel is now set equal to, it states it is set equal to nothing. Do you think that could be the cause of the issue?
In the line where you wrote the drawing path, dont forget to put .(SLDDRW) at the end, even if your file name dont have it. I know it does not make scence, but i tried it, and it works!
I am getting the same error and after reading the below comments. I have tried the work arounds but didn't helped. Can you please help @MLC CAD Systems.
Thank you for the video, would you mind giving us some advice, how come my Index search for API help does not have anything that shows as the video shown? do I need to update to help? and how?
This tutorial is old but it shows a fundamental workflow that is useful for beginners. Your help file is likely to look different from this one.
I know this was a while ago but I encountered a similar issue while watching these videos. I realized I was opening the help section from the VB Editor rather than the API help from inside solidworks, and that they show different content
how can i add the isometric view on the drawing?
Yes, if you can do it with a mouse and a keyboard it is almost certainly possible with the API. If you watch the entire series of videos you'll see how to find the command and structure the code.
How to use macros in assembly
And motion created sir..?
The basic principles shown in this tutorial can be applied to almost all of the functions within SOLIDWORKS, good luck!
Thanks for sharing the information. Your video is blurry in between. So I could not read the video content in between. Example: 5:16, 19:26, I crosschecked it in different browsers. Still, it is the same blurry image in a video. So we could not follow. Appreciate your effort in sharing the information.
Sorry about that, this video wasn't recorded in full HD because it is much older but is still a great introduction to the workflow of programming. I'm glad you appreciate the content, if you want more like this you can also check out CADSharp.com.
would you mind sharing this code please ?
Unfortunately, we do not have a copy of the finished code. The video is supplied as educational only. Similar code can be found online and in the help documentation.
Hi Keith,
Could you please help me to sort out this error? see the below screenshot
For API support you will get best results by going direct to your Reseller, SOLIDWORKS, or an API forum online. You can also check out www.cadsharp.com/ which is Keith's company, he was a featured guest on our channel for this video series.
15:00
25:00
Hey, did you have a question?
Any intersted in learning solidworks API advance learning please ping me
We're happy to discuss it, you can reach out with your contact information at www.mlc-cad.com/contact-us/ or reach out to CAD Sharp at www.cadsharp.com/, they are the ones we collaborated with for this particular event and they have a lot of on-demand content.
23
30
Hi,
thank you for the informative series. How can I choose drawing view 3 to add the dimensions?
I changed the line:
swModel.Extension.SelectByID2 "Drawing View1", "DRAWINGVIEW", 0, 0, 0, False, 0, Nothing, 0
to:
swModel.Extension.SelectByID2 "Drawing View3", "DRAWINGVIEW", 0, 0, 0, False, 0, Nothing, 0
The result is the same, even if I try to activate the view:
swDraw.ActivateView "Drawing View3"
Thank you.
I recommend reaching out to the community for support learning how to use and develop with the API. The SOLIDWORKS Forum forum.solidworks.com/ or the Reddit SOLIDWORKS community www.reddit.com/r/SolidWorks/ should be able to assist.