Note: This discussion is about an older version of the COMSOL Multiphysics® software. The information provided may be out of date.

Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.

COMSOL JAVA API to Control Camera

Please login with a confirmed email address before reporting spam

Hi,

I am using COMSOL 4.4 JAVA API to export a series of group plots images. However, the model is ugly aligned in the output image. I am wondering is there any way to control the camera attributions using JAVA API?

3 Replies Last Post 18 mag 2016, 09:38 GMT-4

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 18 mag 2016, 01:04 GMT-4
P.S

I read the API manual and only find the following code and limited explanation:
model.view(<vtag>).camera().set(<pname>, <pvalue>) sets the given camera property to the given value.

However, no more information is given for <pname> parameter. Which parameter should be given to configure the Zoom Angle, Position, Target,Up Vector, Center of Rotation, View Offset?

Any suggestion is appreciated.

Thanks,
Bob


P.S I read the API manual and only find the following code and limited explanation: model.view().camera().set(, ) sets the given camera property to the given value. However, no more information is given for parameter. Which parameter should be given to configure the Zoom Angle, Position, Target,Up Vector, Center of Rotation, View Offset? Any suggestion is appreciated. Thanks, Bob

Magnus Ringh COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 18 mag 2016, 05:05 GMT-4
Hi,

The properties for controlling the camera are documented in the COMSOL Multiphysics Programming Reference Manual (such as 'target', 'position', and 'up' vectors), at least in later versions of COMSOL Multiphysics.

Another way of getting the properties and syntax is to make camera adjustments in the COMSOL Desktop and then save the model as a Model File for Java. That file will contain the camera API calls that correspond to the changes you made to the camera settings.

Best regards,
Magnus Ringh, COMSOL
Hi, The properties for controlling the camera are documented in the COMSOL Multiphysics Programming Reference Manual (such as 'target', 'position', and 'up' vectors), at least in later versions of COMSOL Multiphysics. Another way of getting the properties and syntax is to make camera adjustments in the COMSOL Desktop and then save the model as a Model File for Java. That file will contain the camera API calls that correspond to the changes you made to the camera settings. Best regards, Magnus Ringh, COMSOL

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 18 mag 2016, 09:38 GMT-4
Hi Magnus,

Thanks for your response and solution provided. But camera setting is not included in the exported java file. With the attributes you mentioned, I finally worked it out after adding more attributes (projection, orthoscale, zoomanglefull, rotationpoint and etc).

However, I encounter another issue: I cannot export the images from the models that are not opened in the client side though they are already loaded in the server side. The following code won't work unless the model has been opened using the client:
model.result().export("img1").run();

(Dataset exportation has no such issue)

Any suggestions to get around this issue?

Thanks,
Bob
Hi Magnus, Thanks for your response and solution provided. But camera setting is not included in the exported java file. With the attributes you mentioned, I finally worked it out after adding more attributes (projection, orthoscale, zoomanglefull, rotationpoint and etc). However, I encounter another issue: I cannot export the images from the models that are not opened in the client side though they are already loaded in the server side. The following code won't work unless the model has been opened using the client: model.result().export("img1").run(); (Dataset exportation has no such issue) Any suggestions to get around this issue? Thanks, Bob

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.