Fit drawing to window

Discuss and ask questions about CADViewX (Lite and Pro versions).

Moderators: support, SDS, admin

Post Reply
pkrzic
Posts: 13
Joined: 29 Jul 2005, 12:13

Fit drawing to window

Post by pkrzic » 05 Jul 2011, 12:04

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.

Image

all my images are now like this:

Image

But they should look like this:

Image

Regards.

support
Posts: 2930
Joined: 30 Mar 2005, 11:36
Contact:

Re: Fit drawing to window

Post by support » 11 Jul 2011, 18:30

Hello.
CADViewX allows fit drawing to window for both versions, Lite and Pro. HTML demo projects contain the examples:
- Lite

Code: Select all

CADViewX.DoToolButtonClick(4)
- Pro

Code: Select all

CADViewX.Actions.Item(36).Execute()
Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

pkrzic
Posts: 13
Joined: 29 Jul 2005, 12:13

Re: Fit drawing to window

Post by pkrzic » 20 Apr 2012, 18:22

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":
Image

Here is also an image of what I want to achieve:
Image



May I say that this works perfectly in CADViewX from 2005.

Mikhail Zhilin
Posts: 39
Joined: 04 Aug 2011, 11:31
Location: Russia

Re: Fit drawing to window

Post by Mikhail Zhilin » 24 Apr 2012, 13:46

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

pkrzic
Posts: 13
Joined: 29 Jul 2005, 12:13

Re: Fit drawing to window

Post by pkrzic » 24 Apr 2012, 15:33

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:

Image

I still think it would be best to have some kind of a parameter:
PARAM name="ZoomAll"VALUE="1">

Regards.

pkrzic
Posts: 13
Joined: 29 Jul 2005, 12:13

Re: Fit drawing to window

Post by pkrzic » 25 Apr 2012, 12:42

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>

support
Posts: 2930
Joined: 30 Mar 2005, 11:36
Contact:

Re: Fit drawing to window

Post by support » 26 Apr 2012, 11:21

Hello.
That's correct, DoToolButtonClick affects CADViewX owner object only.

Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

Post Reply