Download

Online

Gallery

Blog

  Index  | Recent Threads  | List Attachments  | Search
 Welcome Guest  |  Register  |  Login
Login Name  Password
 

Sweet Home 3D Forum



No member browsing this thread
Thread Status: Active
Total posts in this thread: 9
[ Jump to Last Post ]
Post new Thread
Author
Previous Thread This topic has been viewed 1164 times and has 8 replies Next Thread
PacWood
Newbie



USA
Joined: Mar 13, 2018
Post Count: 8
Status: Offline
Reply to this Post  Reply with Quote 
zoom for HTML5 tool file is weak compared to program zoom

Hello,

When I do a "Tools > Export to HTML5" , the .html file viewHomeInOverlay.html
contains the building that I have been working on and it looks good.

However, when I zoom in on 3d view of the building, there appears to be a limit with the zoom for 3d aerial view.
(In the viewHomeInOverlay.html that was created by the "Export to HTML5")

The building is 330 feet in x direction and 100 feet in y direction and
it is 2 floors. (it is a warehouse)

In comparison, while view the same building in the "Sweet Home 3d" program, the zoom for the 3d aerial view is very good zoom.
I am able to zoom in on furniture very well and see even the kitchen sink in detail.
The zoom is very powerful in the Sweet Home 3d program, though it too has a zoom limit.

The zoom with the viewHomeInOverlay.html file that contains the 3d view from the "Export to HTML5" tool
is not nearly as powerful as the zoom in the Sweet Home 3d program.

I thought maybe the warehouse is too big, so for a test, I made a simple 1 floor house and the zoom for the 3d aerial view is still limited in the .html file that is created by the "Export to HTML5". (Limited meaning the zoom is not as powerful as the zoom in the Sweet Home 3d program 3d view)

Does anyone also see a limitation with the zooming feature on the 3d aerial view
in the html file from the "Tools > Export to HTML5" ?

On a side note, if I set the width=4000 and height=1600 for the canvas in the .html file,
then the 3d view is very large and I can see the furniture much better.
But, the webpage is much less than 4000x1600 px.

Maybe there is some setting that needs to be set prior to doing the "Export to HTML5"?
or
is there some javascript object setting to set the maximum zoom in the viewHomeInOverlay.html file?

I have searched the forums but it appears no one has noticed the .html file has a lesser zoom for the 3d view than the 3d view in the Sweet Home 3d program.

Any help or suggestions to make the zoom better for the .html file is very appreciated.

thank you.
[Mar 13, 2018, 10:11:01 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Puybaret
Expert
Member's Avatar

France
Joined: Nov 7, 2005
Post Count: 9141
Status: Offline
Reply to this Post  Reply with Quote 
Re: zoom for HTML5 tool file is weak compared to program zoom

When the selection is empty, you can't get closer than the limits of the bounding box of your home. But you probably activated the Aerial view centered on selection option in Sweet Home 3D preferences panel and selected an object in your home, in which case you can get closer.
You can reproduce the same behavior in Sweet Home 3D JS, by setting the same option and selecting an object by program. Just call setAerialViewCenteredOnSelectionEnabled and setSelectedItems. See also omrico request here.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[Mar 13, 2018, 2:11:21 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
PacWood
Newbie



USA
Joined: Mar 13, 2018
Post Count: 8
Status: Offline
Reply to this Post  Reply with Quote 
Re: zoom for HTML5 tool file is weak compared to program zoom

Hello,

Thank you for your fast reply.

You are correct that I activated the Aerial view centered on selection option in Sweet Home 3D preferences panel
and selected an object in my buiding and was able to get closer.

As you suggested, I read omrico's thread.
In omrico's thread, there is the statement:
"The HomePreviewComponent returned by viewHome has access to UserPreferences."

I was hoping to do the following:

var HPC = viewHome(...);
var UP = HPC.getUserPreferences;
UP.setAerialViewCenteredOnSelectionEnabled(true);

But the browser states that the variable "UP" is undefined.

Below is the actual code used in the HTML.

<script>
var HPC = viewHome("viewerCanvas",
homeUrl,
onerror,
onprogression,
{roundsPerMinute: 0,
navigationPanel: "default",
levelsAndCamerasListId: "levelsAndCameras",
selectableLevels: ["Level 1", "Level 2"],
activateCameraSwitchKey: true
});


console.log(HPC);
var UP = HPC.getUserPreferences;
console.log(UP);
</script>


How do I get access to the UserPreferences so I can set the setAerialViewCenteredOnSelectionEnabled to true?
(and also to select an object)


thank you very much.
[Mar 13, 2018, 5:07:51 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
PacWood
Newbie



USA
Joined: Mar 13, 2018
Post Count: 8
Status: Offline
Reply to this Post  Reply with Quote 
Re: zoom for HTML5 tool file is weak compared to program zoom

While re-reading the post, I noticed I did not copy this line in the previous post:

"UP.setAerialViewCenteredOnSelectionEnabled(true);"

Below is the code with the missing line at the end.


<script>

var HPC = viewHome("viewerCanvas",
homeUrl,
onerror,
onprogression,
{roundsPerMinute: 0,
navigationPanel: "default",
levelsAndCamerasListId: "levelsAndCameras",
selectableLevels: ["Level 1", "Level 2"],
activateCameraSwitchKey: true
});


console.log(HPC);
var UP = HPC.getUserPreferences;
console.log(UP);
UP.setAerialViewCenteredOnSelectionEnabled(true);

</script>


Below is a screen shot of the console log while running the above script that is in the .html file.

The console shows an "undefined".

Am I accessing the User Preference correctly?

thank you.






[Mar 13, 2018, 9:27:06 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Puybaret
Expert
Member's Avatar

France
Joined: Nov 7, 2005
Post Count: 9141
Status: Offline
Reply to this Post  Reply with Quote 
Re: zoom for HTML5 tool file is weak compared to program zoom

In JavaScript, you have to put some parenthesis after a method even if it takes no parameter.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[Mar 13, 2018, 9:38:25 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
PacWood
Newbie



USA
Joined: Mar 13, 2018
Post Count: 8
Status: Offline
Reply to this Post  Reply with Quote 
Re: zoom for HTML5 tool file is weak compared to program zoom

Hello,

Thank you for your help.
Yes, the HPC.getUserPreferences should have been HPC.getUserPreferences()
with the parenthesis. Thank you.

I have noticed that there is still an "undefined" error when I use
the obj returned by HPC.getUserPreferences() with the code below.

I set a break point to follow the error, and then the "undefined" error when away
and I can see in the UP variable that the "AerialViewCenteredOnSelectionEnabled" was set to 'true'.

It then occurred to me there is a timing issue.

The UserPreferences obj returned by HPC.getUserPreferences() is undefined until after the "Home" is loaded.

How can I tell when the "Home" is loaded?

Is there some global flag somewhere that I can periodically check to make sure the "Home" is loaded into memory?

I am thinking that after the "Home" is loaded,
then I can safely call "HPC.getUserPreferences();"

Below is the code being used now:


<script>
var HPC = viewHome("viewerCanvas",
homeUrl,
onerror,
onprogression,
{ roundsPerMinute: 0,
navigationPanel: "default",
levelsAndCamerasListId: "levelsAndCameras",
selectableLevels: ["Level 1", "Level 2"],
activateCameraSwitchKey: true
});


console.log('AAAA');
var UP = HPC.getUserPreferences();
console.log('BBBB');
UP.setAerialViewCenteredOnSelectionEnabled(true);
console.log('CCCC');
<script>


Thank you much.
[Mar 14, 2018, 7:42:19 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
PacWood
Newbie



USA
Joined: Mar 13, 2018
Post Count: 8
Status: Offline
Reply to this Post  Reply with Quote 
Re: zoom for HTML5 tool file is weak compared to program zoom

Hello,

I put in a 6 second delay timer and then did the getUserPreferences();

The code is able to access the HOME data.

When the setSelectedItems is called, I pass in a list:
var itemSel = ["209","210"];
HOME.setSelectedItems(itemSel);

However, the zoom in the .html file does not zoom into the selected Item.

Below is the code:



<script>
var HPC = viewHome("viewerCanvas",
homeUrl,
onerror,
onprogression,
{ roundsPerMinute: 0,
navigationPanel: "default",
levelsAndCamerasListId: "levelsAndCameras",
selectableLevels: ["Level 1", "Level 2"],
activateCameraSwitchKey: true
});

setTimeout(myTimer, 6000);

function myTimer() {
var UP = HPC.getUserPreferences();
var HOME = HPC.getHome();
var items = HOME.getSelectableViewableItems();
console.log(items);
UP.setAerialViewCenteredOnSelectionEnabled(true);
console.log('CCCC');
var itemSel = ["209","210"];
HOME.setSelectedItems(itemSel);
}
</script>



Included at the bottom of this post is a screen shot.
The building is on the left and the
list of selectable items is shown in the console.

The zoom is not zooming into the selection.

Am I doing the selection correctly?

Is there some line of code that I may be missing?

Thank you very much for your advice.




[Mar 14, 2018, 8:18:48 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
PacWood
Newbie



USA
Joined: Mar 13, 2018
Post Count: 8
Status: Offline
Reply to this Post  Reply with Quote 
Re: zoom for HTML5 tool file is weak compared to program zoom

Hello,

Thank you for your help.

I see that the selected items was not correct in my previous code
so I made a correction.

The close zoom is finally working in the .html file.

Thank you for a great program!
I made a small donation yesterday.


<script>
var HPC = viewHome("viewerCanvas",
homeUrl,
onerror,
onprogression,
{ roundsPerMinute: 0,
navigationPanel: "default",
levelsAndCamerasListId: "levelsAndCameras",
selectableLevels: ["Level 1", "Level 2"],
activateCameraSwitchKey: true
});

setTimeout(myTimer, 6000);

function myTimer() {
var UP = HPC.getUserPreferences();
var HOME = HPC.getHome();
var items = HOME.getSelectableViewableItems();
console.log(items);
UP.setAerialViewCenteredOnSelectionEnabled(true);
var itemSel = [items[210]];
HOME.setSelectedItems(itemSel);
console.log(HOME);
}
</script>



Thanks again.
[Mar 14, 2018, 8:56:34 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Puybaret
Expert
Member's Avatar

France
Joined: Nov 7, 2005
Post Count: 9141
Status: Offline
Reply to this Post  Reply with Quote 
Re: zoom for HTML5 tool file is weak compared to program zoom

It's great that you could achieve it by yourself smile
As you finally found out, setSelectedItems method takes an array of objects (furniture, walls or other objects stored in a Home instance) and not an array of numbers or quoted numbers.

How can I tell when the "Home" is loaded?
The home loading process can be tracked in the onprogression callback. Just change the existing callback in the condition part === HomeRecorder.READING_HOME. Doing so will be much safer than programming a timer with a delay that may vary with bandwidth and CPU power.

Thanks for the donation smile
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[Mar 14, 2018, 9:26:42 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
[ Jump to Last Post ]
Show Printable Version of Thread  Post new Thread

    Get Sweet Home 3D at SourceForge.net. Fast, secure and Free Open Source software downloads
   
© Copyright 2006-2024 eTeks - All rights reserved