Page 1 of 1
Fit drawing to window
Posted: 05 Jul 2011, 12:04
by pkrzic
Hello,
I am using Cadviewx from the first release. It used to do this automatically but in the latest version my DWG file does not automatically fit into the window. I can also not find any HTML option (parameter) for this in the help.
all my images are now like this:
But they should look like this:
Regards.
Re: Fit drawing to window
Posted: 11 Jul 2011, 18:30
by support
Hello.
CADViewX allows fit drawing to window for both versions, Lite and Pro. HTML demo projects contain the examples:
- Lite
- Pro
Code: Select all
CADViewX.Actions.Item(36).Execute()
Alexander.
Re: Fit drawing to window
Posted: 20 Apr 2012, 18:22
by pkrzic
Hello,
This solution works when you have buttons.
But I want to have the image resized automatically at the moment the HTML opens.
I also need many objects on a single HTML page.
As I am aware currently this is only possible by manually clicking "Fit drawing to window":
Here is also an image of what I want to achieve:
May I say that this works perfectly in CADViewX from 2005.
Re: Fit drawing to window
Posted: 24 Apr 2012, 13:46
by Mikhail Zhilin
Hello,
try the following solution:
Code: Select all
<HTML>
<HEAD>
<TITLE>Example for showing CADViewX Object</TITLE>
<meta name="vs_snapToGrid" content="True">
<meta name="vs_showGrid" content="True">
<script id="clientEventHandlersJS" language="vbscript">
<!--
sub CADViewX_OnAfterLoad
CADViewX.DoToolButtonClick(4)
end sub
sub bodyload
CADViewX.FileName = "http://www.soft-gold.ru/cadsofttools_demo.dxf"
end sub
//-->
</script>
</HEAD>
<BODY onload=bodyload BGCOLOR="steelblue">
<object id=CADViewX height=408 width=568
classid=clsid:F5F6C0A5-0D6F-41F6-932C-BB1D4F3566D5 name=CADViewX
VIEWASTEXT>
</object>
</BODY>
</HTML>
Mikhail
Re: Fit drawing to window
Posted: 24 Apr 2012, 15:33
by pkrzic
This works but as soon as I put an object into the table it doesn' t work anymore.
Here's the code:
Code: Select all
<HTML>
<HEAD>
<TITLE>Example for showing CADViewX Object</TITLE>
<meta name="vs_snapToGrid" content="True">
<meta name="vs_showGrid" content="True">
<script id="clientEventHandlersJS" language="vbscript">
sub CADViewX_OnAfterLoad
CADViewX.DoToolButtonClick(4)
end sub
</script>
</HEAD>
<BODY BGCOLOR="steelblue">
<table>
<tr>
<td>
<object id=CADViewX height=150 width=150
classid=clsid:F5F6C0A5-0D6F-41F6-932C-BB1D4F3566D5 name=CADViewX
VIEWASTEXT>
<PARAM name="FileName" value="http://www.soft-gold.ru/cadsofttools_demo.dxf">
<PARAM name="ToolBarVisible"VALUE="False">
<PARAM name="LayoutsBarVisible"VALUE="False">
<PARAM name="IsWithoutBorder"VALUE="True">
<PARAM name="DrawMode"VALUE="1">
</object>
</td>
</tr>
</table>
<br><br>
<object id=CADViewX height=150 width=150
classid=clsid:F5F6C0A5-0D6F-41F6-932C-BB1D4F3566D5 name=CADViewX
VIEWASTEXT>
<PARAM name="FileName" value="http://www.soft-gold.ru/cadsofttools_demo.dxf">
<PARAM name="ToolBarVisible"VALUE="False">
<PARAM name="LayoutsBarVisible"VALUE="False">
<PARAM name="IsWithoutBorder"VALUE="True">
<PARAM name="DrawMode"VALUE="1">
</object>
</BODY>
</HTML>
and here is the result:
I still think it would be best to have some kind of a parameter:
PARAM name="ZoomAll"VALUE="1">
Regards.
Re: Fit drawing to window
Posted: 25 Apr 2012, 12:42
by pkrzic
I found the solution to this issue.
Here is the code that works fine:
Code: Select all
<HTML>
<HEAD>
<TITLE>Example for showing CADViewX Object</TITLE>
<meta name="vs_snapToGrid" content="True">
<meta name="vs_showGrid" content="True">
<script type="text/javascript">
function CADViewXResetParameters()
{
var CADViewXObjectArray = document.getElementsByName('CADViewX');
for (var i = 0; CADViewXObjectArray[i]; i++)
{
CADViewXObjectArray[i].DoToolButtonClick(4);
}
}
</script>
</HEAD>
<BODY BGCOLOR="steelblue" onload ="javascript:CADViewXResetParameters()">
<table>
<tr>
<td>
<object id=CADViewX height=150 width=150
classid=clsid:F5F6C0A5-0D6F-41F6-932C-BB1D4F3566D5 name=CADViewX
VIEWASTEXT>
<PARAM name="FileName" value="http://www.soft-gold.ru/cadsofttools_demo.dxf">
<PARAM name="ToolBarVisible"VALUE="False">
<PARAM name="LayoutsBarVisible"VALUE="False">
<PARAM name="IsWithoutBorder"VALUE="True">
<PARAM name="DrawMode"VALUE="1">
</object>
</td>
</tr>
</table>
<br><br>
<object id=CADViewX height=150 width=150
classid=clsid:F5F6C0A5-0D6F-41F6-932C-BB1D4F3566D5 name=CADViewX
VIEWASTEXT>
<PARAM name="FileName" value="http://www.soft-gold.ru/cadsofttools_demo.dxf">
<PARAM name="ToolBarVisible"VALUE="False">
<PARAM name="LayoutsBarVisible"VALUE="False">
<PARAM name="IsWithoutBorder"VALUE="True">
<PARAM name="DrawMode"VALUE="1">
</object>
</BODY>
</HTML>
Re: Fit drawing to window
Posted: 26 Apr 2012, 11:21
by support
Hello.
That's correct, DoToolButtonClick affects CADViewX owner object only.
Alexander.