Re: API: saveas dwg 1:1 scale output

in message


you should be scaling it when opening it in autocad. but if you need to scale it in solidworks. i think you will have to use vb sendkeys and mouse_events. from what i can see there is no api for scaling dwg's
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Sean Phillips wrote:
in message

So there is no consitent way in saving dwg file using a macros. That would mean all other macro's are not able to handle this correctly. I don't believe it.
Can you help me to use the sendkey. How do I know what key combination I have to send to get the file export dialog box?
Johnny
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
ThScale for all element can be set by API in VB. for the sheet scale use
Part.ClearSelection Part.SetupSheet4 "Sheet1", 12, 12, 1, 10, True, "D:\Drawing Templates\A3-TEMP.slddrt", 0.42, 0.297, "Default" -The 1 and 10 are the sheet scale
Also look up in the API help file for the following functions.
"SetupSheet4" retval = DrawingDoc.SetupSheet4 ( name, paperSize, templateIn, scale1, scale2, firstAngle, templateName, width, height, propertyViewName )
"Scale2" Scale = PageSetup.Scale2 (VB Get property) PageSetup.Scale2 = Scale (VB Set property)
"ScaleDecimal" scale = View.ScaleDecimal (VB Get property) View.ScaleDecimal = scale (VB Set property)
"ScaleRatio" scale = View.ScaleRatio (VB Get property) View.ScaleRatio = scale (VB Set property)
-- Tony O'Hara Melbourne, Australia.
wrote in message

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Tony O'Hara wrote:

Wait a moment. Probably there is something I don't get. I use in SW different sheet scales to fit the models on drawing, mainly A4 size. In automatically producing the dwg files for including in our production system I use a vb script. During this translation (export) there is a manual option to assign the sheet scale (file export option). The manual work around to get the correct dwg output I always open the export options and close it. This ensure the correct output except for the text in scaled blocks. This is what I want to automate.
I looked in several dwg-export macros and found no solution.
If I follow You correctly Your suggetion is about setting up a drawing sheet with a certain scale.
What am I missing?
Johnny
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Agreed, I was on the wrong track. I just noticed the post from fatalerror64 and agree with him/her.
There are settings in swconst.bas for setting almost, if not all options for all SaveAs formats. The trick is learning how to use them.
Have a look at the SWX API site http://files.solidworks.com/API/Examples/00000/0100s/0118/Example.htm
************************************ Also ref to site, although for VB the file referred to is swconst.bas http://www.transcendata.com/support/dexcenter/doc/v42/admin/dexc_AdminGuide - 08.htm Section 9 - Solidworks Flavors Solidworks flavoring is controlled by setting various user preference values in the form "swApp.SetUserPreferenceToggle #,'value'" or "swApp.SetUserPreferenceIntegerValue #,'value'" Where # is the corresponding number of the preference parameter as defined in the Solidworks swconst.h file. Value is a value to which the preference parameter can be set. ************************************
-- Tony O'Hara Melbourne, Australia.
wrote in message

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
You can use something like this: vShtProps = swSheet.GetProperties dScale1 = vShtProps(2) dScale2 = vShtProps(3) swApp.SetUserPreferenceIntegerValue swDxfOutputNoScale, 1 swApp.SetUserPreferenceDoubleValue swDxfOutputScaleFactor, (dScale2/dScale1) before saving the model as a DWG.
in message

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

(dScale2/dScale1) hey, an anonymous poster who knows undocumented preferences ! swDxfOutputNoScale is not even in apihelp.chm 2003. SP3.1 ! is it you, Trevor ?
Philippe Guglielmetti - www.dynabits.com
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Philippe Guglielmetti wrote:

it exist and is written in the swconst file.
Johnny
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
"Johnny Geling wrote:

Sure, otherwise it wouldn't work ;-) Although it is easy to guess how to use it once you know it is there, I wondered why someone knewing this would keep anonymity. "fatalerror" would be a funny nickname for a SW insider ;-)
Philippe Guglielmetti - www.dynabits.com
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Actually, I stumbled across this in swconst.bas while working on a project for one of my customers. While my handle surely fits SW at times, it was not by design. I just like keeping myself in the dark...

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
take a look at the : swxJRNL.swj file in your solidworks directory it logs in code what are doing in solidworks, for me this helps quite a lot to automate things if you don't know were to look in the api.
let me know if this helped. regards,
niek maarse technical engineer Saint-Gobain Abrasives
in message

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here. All logos and trade names are the property of their respective owners.