harmonic.mz.manager
Class MZ_HighLevels

java.lang.Object
  |
  +--harmonic.mz.manager.MZ_HighLevels

public class MZ_HighLevels
extends java.lang.Object

These are high level alternatives to the regular API. Handy for macros. The idea of this class is that a macro could use this class exclusivly instead of the using the Modelzilla development API. But feel free to use the regular API if this class doesn't have the methods you need. Some methods here seem to be more like fully interactive commands. This is because we are experimenting with a command line interface, and it is nice if the more programatic methods are integrated with the one liners.

A Macro instantiates an MZ_HighLevels and high levels from application modules like CAD_HighLevels. For example:

   CAD_HighLevels	cad = new CAD_HighLevels();
	 MZ_HighLevels mz = new MZ_HighLevels();
	 ...
	 cad.sphere(...);
	 mz.redraw();
	 ...
 


Constructor Summary
MZ_HighLevels()
           
 
Method Summary
 void close(FileNode file)
          Close the given file
 boolean confirm(java.lang.String msg)
          Send a modal message with yes/no response.
 harmonic.viewer3D.Viewport currentViewport()
           
 DataNode firstSelection()
          Return the first node of the current selection.
 void fitAndCenterViewpoint(ShapeNode[] shapeDefs)
          Validates, fits, and centers given shapes.
 void fitViewpoint(ShapeNode[] shapeDefs)
          Validates and fits given shapes.
 FileNode getCurrentFile()
          Returns the current FileNode.
 harmonic.meshGeom.math.TMat getGlobalPerUCS()
          Return the UCS matrix.
 harmonic.meshGeom.math.TMat getViewpoint()
          Get the view per global matrix of the current viewport
 void hide(ShapeNode node)
          Hide the node from all viewports
 Module loadModule(java.lang.String className)
          Load the specified module
 void msg(java.lang.String msg)
          Send a message.
 DataNode node(java.lang.String name)
          Return the node with the given name in the current file, or null if there is none.
 DataNode nodeNumber(int number)
          Return the node with the given serial number in the current file, or null if there is none.
 FileNode open(java.lang.String filename)
          open(filename, true, false);
 FileNode open(java.lang.String filename, boolean bMakeCurrent, boolean bLocked)
          Open a repository file.
 FileNode openLocal(java.lang.String filename)
          Opens a file and return reference to it.
 void purge()
          Do a purge
 void recallUCS(java.lang.String name)
          Recall current ucs matrix from given name in ucs list
 void redraw()
          Does a redraw of current viewport.
 void remove(ModelNode node)
          Remove the node from the repository.
 void removeUCS(java.lang.String name)
          Remove a saved ucs name
 void save(FileNode file)
          save(file, file.getFilename(), false, false, "");
 void save(FileNode file, java.lang.String filename, boolean bSaveImage, boolean bCompress, java.lang.String desc)
          Save the given file
 void saveLocal(FileNode file)
          This is like openLocal().
 void saveUCS(java.lang.String name)
          Save current ucs matrix to given name in ucs list, creating new name
 DataNode[] selection()
          Return the current selection.
 void setGlobalPerUCS(harmonic.meshGeom.math.TMat mat)
          Sets the UCS matrix.
 void setViewpoint(harmonic.meshGeom.math.TMat mat)
          Set the view per global matrix of the current viewport
 void show(ShapeNode node)
          Show the node in all viewports
 void showGCS(boolean b)
          Set visibility of gcs triple
 void showUCS(boolean b)
          Set visibility of ucs triple
 void takeScreenShot(java.lang.String filename, java.lang.String encodingType, boolean bAntiAlias)
          Returns a BufferedImage of the current viewport.
 void takeScreenShot(java.lang.String filename, java.lang.String encodingType, int width, int height, boolean bAntiAlias)
          Saves and image file of the current viewport.
 void unloadModule(java.lang.String className)
          Unload the specified module
 void updateUCS(java.lang.String name)
          Save current ucs matrix to given name in ucs list, using existing name
 void validate()
          Validation causes repository nodes to compute derived data, which ends up in the viewport.
 void validate(ModelNode node)
          Validate the node
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MZ_HighLevels

public MZ_HighLevels()
Method Detail

msg

public void msg(java.lang.String msg)
Send a message. MZ.messages().msg(msg);


confirm

public boolean confirm(java.lang.String msg)
Send a modal message with yes/no response. return MZ.messages().confirm(msg);


node

public DataNode node(java.lang.String name)
Return the node with the given name in the current file, or null if there is none. If the file has multiple nodes with the same name, the first found is returned.


nodeNumber

public DataNode nodeNumber(int number)
Return the node with the given serial number in the current file, or null if there is none. Serial numbers are guaranteed to be unique within a file.


firstSelection

public DataNode firstSelection()
Return the first node of the current selection.


selection

public DataNode[] selection()
Return the current selection.


loadModule

public Module loadModule(java.lang.String className)
Load the specified module

Parameters:
className - Fully specified class name
Returns:
Loaded module

unloadModule

public void unloadModule(java.lang.String className)
Unload the specified module


hide

public void hide(ShapeNode node)
Hide the node from all viewports


show

public void show(ShapeNode node)
Show the node in all viewports


validate

public void validate(ModelNode node)
Validate the node


remove

public void remove(ModelNode node)
Remove the node from the repository. Or use node.remove();


purge

public void purge()
Do a purge


open

public FileNode open(java.lang.String filename)
open(filename, true, false);


open

public FileNode open(java.lang.String filename,
                     boolean bMakeCurrent,
                     boolean bLocked)
Open a repository file. (An MVG file.)

Parameters:
bMakeCurrent - If true, file become target of modifications
bLocked - If true, file cannot be modified

openLocal

public FileNode openLocal(java.lang.String filename)
Opens a file and return reference to it. Will not make current, bind any bindables or add it to database, or validate the model tree. The idea is return a temporary model that can be thown away or copied to another model.


getCurrentFile

public FileNode getCurrentFile()
Returns the current FileNode. This is the default file that is effected by user action.


close

public void close(FileNode file)
Close the given file


save

public void save(FileNode file)
save(file, file.getFilename(), false, false, "");


save

public void save(FileNode file,
                 java.lang.String filename,
                 boolean bSaveImage,
                 boolean bCompress,
                 java.lang.String desc)
Save the given file


saveLocal

public void saveLocal(FileNode file)
This is like openLocal(). The saveing of the file will have no side effects.


getGlobalPerUCS

public harmonic.meshGeom.math.TMat getGlobalPerUCS()
Return the UCS matrix. This is the coordinate system of new objects created by the cad application, and possibly others.


setGlobalPerUCS

public void setGlobalPerUCS(harmonic.meshGeom.math.TMat mat)
Sets the UCS matrix. See getGlobalPerUCS().


saveUCS

public void saveUCS(java.lang.String name)
Save current ucs matrix to given name in ucs list, creating new name


recallUCS

public void recallUCS(java.lang.String name)
Recall current ucs matrix from given name in ucs list


updateUCS

public void updateUCS(java.lang.String name)
Save current ucs matrix to given name in ucs list, using existing name


removeUCS

public void removeUCS(java.lang.String name)
Remove a saved ucs name


showGCS

public void showGCS(boolean b)
Set visibility of gcs triple


showUCS

public void showUCS(boolean b)
Set visibility of ucs triple


fitAndCenterViewpoint

public void fitAndCenterViewpoint(ShapeNode[] shapeDefs)
Validates, fits, and centers given shapes.


fitViewpoint

public void fitViewpoint(ShapeNode[] shapeDefs)
Validates and fits given shapes.


setViewpoint

public void setViewpoint(harmonic.meshGeom.math.TMat mat)
Set the view per global matrix of the current viewport


getViewpoint

public harmonic.meshGeom.math.TMat getViewpoint()
Get the view per global matrix of the current viewport


currentViewport

public harmonic.viewer3D.Viewport currentViewport()

redraw

public void redraw()
Does a redraw of current viewport. Will not return untill redraw is finished. Use this method in a macro that does an animation. Calls:
   ViewerCore.viewports().getCurrentView().renderNow();
 


takeScreenShot

public void takeScreenShot(java.lang.String filename,
                           java.lang.String encodingType,
                           boolean bAntiAlias)
Returns a BufferedImage of the current viewport.


takeScreenShot

public void takeScreenShot(java.lang.String filename,
                           java.lang.String encodingType,
                           int width,
                           int height,
                           boolean bAntiAlias)
Saves and image file of the current viewport. For encoding type, use one of "GIF", "TIFF", "PNG", "JPEG", "BMP"


validate

public void validate()
Validation causes repository nodes to compute derived data, which ends up in the viewport. Call this if auto validation has been turned off.