Fit drawing to window

If you have any comments or questions about our CADViewX, please do not hesitate to contact us at this forum

Moderators: admin, SDS, support

Fit drawing to window

Postby pkrzic » 05 Jul 2011, 09: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.
pkrzic
 
Posts: 13
Joined: 29 Jul 2005, 09:13

Re: Fit drawing to window

Postby support » 11 Jul 2011, 15: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.
Please post questions to the forum or write to support@cadsofttools.com
support
 
Posts: 2226
Joined: 30 Mar 2005, 08:36
Location: Russia

Re: Fit drawing to window

Postby pkrzic » 20 Apr 2012, 15: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.
pkrzic
 
Posts: 13
Joined: 29 Jul 2005, 09:13

Re: Fit drawing to window

Postby Mikhail Zhilin » 24 Apr 2012, 10: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
Mikhail Zhilin
 
Posts: 27
Joined: 04 Aug 2011, 08:31
Location: Russia

Re: Fit drawing to window

Postby pkrzic » 24 Apr 2012, 12: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, 09:13

Re: Fit drawing to window

Postby pkrzic » 25 Apr 2012, 09: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>
pkrzic
 
Posts: 13
Joined: 29 Jul 2005, 09:13

Re: Fit drawing to window

Postby support » 26 Apr 2012, 08:21

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

Alexander.
Please post questions to the forum or write to support@cadsofttools.com
support
 
Posts: 2226
Joined: 30 Mar 2005, 08:36
Location: Russia


Return to CADViewX

Who is online

Users browsing this forum: No registered users and 1 guest