Sorry no API for setting base scale, vote for SPR # 190359
Create a new sheet and paste that view on that sheet with scale set to 1:1 and export DXF. And then delete that sheet. All this can be done via macro.
Thanks Deepak, I hadn't thought of that. I will work on it.
Although I'm a great fan of Deepak work, hes answer is not right.
There is no need to have base scale, there is no need to insert new sheet with 1:1 scale !!
Thru simple calculation, you can make that exported drawing view(s) will be always in 1:1 scale . Base idea is:
dDXFScaleFactor = SwViewScale * (scale1 / scale2) * (1 / (SwViewScale * (scale1 / scale2))) * (1 / SwViewScale)
scale1 and scale2 are sheet properties (sheet scale)
SwViewScale is view scale in decimal setting
Then you need to set:
All Views that have the same scale as the one used for calcucation of formula above will be exported in 1:1 rest of it will be exported in other scales.
I am just adding note to DXF that only main views are scaled 1:1, others should be checked before use by autocad user.
Some time ago, I did have same problem as you, I've looked for few days in different forums about answer and nothing, and it was so simple!!
You need to have number that multiplied by sheetscale * viewscale will give you 1. Then just some tool to set dxfoutputscale, and because SW is using one in window that you showed us in your print screen, there should be some kind of settings to set is, and voila. Its the Answer.
you did, however, your method do not export whole drawing content to dxf, just drawing views with no dimension, annotations and so on.
Try this one, works better than anything that concern dxf export problem.
So close! I can set the Output Scale (and read it back) however all of the save types I have tried don't result in an actual 1:1 scaled dwg.
What save style have you used?
last two lines of code:
bool = swApp.SetUserPreferenceDoubleValue(swDxfOutputScaleFactor, dDXFScaleFactor)
bool = swModel.SaveAs4(SwOpenPath & ".dxf", 0, 1, errors, Warnings)
SwOpenPath = Left(swModel.GetPathName, InStr(swModel.GetPathName, ".") - 1) 'Set Path before ".extension in file name"
BTW: you will have 1:1 scale in views that have same scale as one selected for whole process, rest of views will have different scales (for example, your main views are front, bottom and top view + detail view (with different scale), you are probing first view in drawing sheet, then its your base scale (front in this example), all three main views will be exported in 1:1 (detail view will be exported in different scale).
I see now, that initially I was wrong, whole calculation line can be written as 1/SwViewScale. So there is no number that makes 1 in dDXFScaleFactor, just some other number that comes from 1/SwViewScale.
Set you view scale to 0.25
Set you sheetScale to 0.2
dDXFScaleFactor should be 4
All views with scale 0.25 will be exported as 1:1, other view will have own scale. Try it, tell me please whats the result.
Sorry for the confusion, i written this macro 6 months ago, did forget some of it already
Ok, I found the problem. The 'Scale Output 1:1' HAS to be enabled in the Export Options to force the SaveAs to use ANY revised scaling.
I did notice the first part of the calculation line always resolved to 1. I am going to add a message box to my macro to choose to use a 1:1 scale based on the view or to use whatever the sheet scale is. That way we either get 1:1 models or we get the standard sheet size that has been set up.
Thanks for the help!
For future reference...
SwViewScale = swView.ScaleDecimal
dDXFScaleFactor = (1 / SwViewScale)
swModel.SaveAs4(NewFilePath, swSaveAsCurrentVersion, swSaveAsOptions_Silent, 0, 0)
where NewFilePath includes the .DWG or .DXF extension.
Like you said, this will only produce a 1:1 for the views that match the SwViewScale, which, in this case for us, will always be the same.