API call
API call
(OP)
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.
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.






RE: API call
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
RE: API call
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
RE: API call
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.
RE: API call
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
RE: API call
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.
RE: API call
Regards,
Jon
jgbena@yahoo.com
RE: API call
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.
RE: API call
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