Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IDS on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

API call

Status
Not open for further replies.

Yogibear

Mechanical
Sep 5, 2002
107
Does anyone know the call for the command "make drawing from
part/assembly" This is a SW04 command.

I'm trying to write a macro that uses that function to create a drawing using a specific border.

Thanks in advance.
 
Replies continue below

Recommended for you

swApp.LoadFile2 "Type the pathname and template filename.drwdot here""
Set Part = swApp.ActiveDoc
swApp.ActiveDoc.ActiveView.FrameLeft = 0
swApp.ActiveDoc.ActiveView.FrameTop = 0
swApp.ActiveDoc.ActiveView.FrameState = 1
swApp.ActiveDoc.ActiveView.FrameState = 1
Set Part = swApp.NewDocument("type the pathname and template filename.drwdot here", 2, 0.2794, 0.4318)



Regards,
Jon
jgbena@yahoo.com
 
oops forgot to type the rest...

Create a template that uses that specific sheet format. Use that drwdot file in the pathname argument.

You could however, create a form that is called when the macro is run that will ask you to browse for the template if you intend to be able to select from different templates, and use that value in the pathname argument instead.. depends on what you want to do.



Regards,
Jon
jgbena@yahoo.com
 
Jon, here is the code I was using.

Set swApp = Application.SldWorks

Set Part = swApp.ActiveDoc
swApp.LoadFile2 "R:\Cad\Solidworks\SolidWorks 04 Templates\Drawing Templates\Metric Drawing.drwdot", ""
Set Part = swApp.ActiveDoc
Set Part = swApp.NewDocument("R:\Cad\Solidworks\SolidWorks 04 Templates\Drawing Templates\IN9001(M B assy).slddrt", 0, 0, 0)

When I put yours in place my sheet format was not visible. It was there because if I did a edit sheet format it showed up.
It still doesn't seem like the drawing is linked back to the part.
 
Hmmm

Curious... I can see the border, thats no problem.. but the issue I have that you just drew my attention to is that I had to insert the model manually... I tied using a template with predefined views and they came in empty...

But the sheet format comes in fine..

What service pack are you using?



Regards,
Jon
jgbena@yahoo.com
 
On my machine I have SP1.0. I will test it on the machine next to me that has 2.1 on it.
Do you get the ghost image border, it's like a 1/2" border around the left and top of the modeling area. It shows what was next up on the desktop.
 
i am on sp0.0 (sp1 - 2.1 have been a little too buggy for my. Im waiting for 3.0 to come out!

Regards,
Jon
jgbena@yahoo.com
 
I can't get the same outcome everytime on my machine or the one with SP2.1 on it.
Still working on it though.
In your statement Set Part = swApp.NewDocument("type the pathname and template filename.drwdot here", 2, 0.2794, 0.4318)
Where did you get the values , 2, 0.2794. . . .
I can't find anywhere that defines those numbers.
 
Yogi,

The Convention is like this.

NewDocument ( templateName, paperSize, width, height )

Papersize is a hardcoded preset list of sizes associated with a number.. for instance see the list below:

1= 11 x 8.5
2= 11 x 17
3= 22 x 17
4= 22 x 34
5= 34 x 44
6= 8.5 x 11
7= 11 x 8.5
8= 11.75 x 16.5
9= 16.5 x 23.375
10= 23.5 x 33

The width and Height values are generally unused or ignored unless you want to use a custom paper size in which case I think that you would use 12 as the papersize value and these numbers are the width and height of the paper that you wish to create.. be aware.. these values are in meters.



Regards,
Jon
jgbena@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor