Public Member Functions | List of all members
Model Class Reference

Model class is used to specify a model.
The class can be called from Application class.
. More...

Public Member Functions

void AddEquation (String &parameterName)
 Adds a parametric equation. More...
 
void ApplyAnalysisTemplate (String &path, StringList &partnames, StringList &setnames, bool renameParts=false, bool renameSets=false, bool onlyAddExistedSets=false, StringList &refnames=StringList(), bool renameRefs=false, bool onlyAddExistedRefs=false, StringList &equationnames=StringList())
 Specifies the analysis template of the tool box and link the template with the CAD model. (includes set). More...
 
void ChangeCadLinkToGeometryEditor ()
 Switches CAD link to Geometry Editor.
 
void CheckFolderResults (String &source)
 Loads result files (*.jplot) in the specified folder. More...
 
void CheckForNewResults ()
 Loads results that have not yet been loaded for all studies in a model.
 
void CleanupOldPartSettings ()
 Removes saved information for missing parts.
 
void ClearMeshGroupSettingAllStudies ()
 Clears the settings of a mesh group.
 
void CloseCadLink ()
 Closes the link to the CAD system.
 
double ConvertValueFromSI (String &unitName, double value)
 Converts value from SI unit to specified unit. More...
 
double ConvertValueToSI (String &unitName, double value)
 Converts value from specified unit to SI unit. More...
 
StudyCopyStudy (Study *study)
 Returns a Study object by copying the specified Study object. More...
 
SelectionCreate2DSelection ()
 Creates a Selection object based on 2D model. More...
 
void CreateAnalysisTemplate (String &title, String &tooltip, String array &studyList, String &folder=String(), double version=1.0 *kProjectFileVersion)
 Creates an analysis template from the selected studies. More...
 
AnalysisTemplateControlCreateAnalysisTemplateControl (String &filepath)
 Creates an AnalysisTemplateControl object. More...
 
SelectionCreateSelection ()
 Creates a Selection object. More...
 
StudyCreateStudy (String &typeName, String &name)
 Creates a study. More...
 
void DeleteMeshCache ()
 Deletes the mesh cache.
 
void DeleteStudy (Variant &var)
 Deletes a study. More...
 
StudyDuplicateStudy (Variant &var, bool copyPoint=true)
 Duplicates the study by specifying a name or index. More...
 
StudyDuplicateStudyName (Variant &var, String &name, bool copyPoint=true)
 Duplicates the study by specifying a name or index. More...
 
StudyDuplicateStudyWithCases (Variant &var, String &name, String array &caseList, String &children=String(), bool copyPoint=true)
 Duplicates the study by specifying a name or index. In this function, the name of the study to be created and the case to be duplicated can be specified. More...
 
StudyDuplicateStudyWithType (Variant &var, String &type, String &name=String(), bool copyPoint=true)
 Duplicates the study by specifying a name or index. In this function, the name and type of the study to be created can be specified. More...
 
void ExportAnalysisParameters (String &filename, bool openCadLink)
 Exports Analysis Parameter items to designated file. More...
 
void ExportAnalysisTemplate (String &filepath)
 Exports a template file (*.jtmpl). More...
 
void ExportSelectedAnalysisTemplate (String &filepath, String array &studyList, double version=1.0 *kProjectFileVersion)
 Exports a template file (*.jtmpl) including the selected study. More...
 
void ExtendTo3DMesh (double length, int divisions, int studyIndex, bool copyStudies=true)
 Extends 2D region models to a 3D model. More...
 
void ExtendTo3DSolid (double length, bool mergeSameSurface=true)
 Extends 2D region models to a 3D model. More...
 
ResultViewItemListGetAllCasesResultViewItemList ()
 Returns result view list for all cases. More...
 
String GetColor (Variant &var)
 Returns the color of the specified part by specifying the name or ID. More...
 
CoordinateSystemListGetCoordinateSystemList ()
 Returns a CoordinateSystemList object. More...
 
String GetCurrentUnit (String &unitGroupName)
 Returns the key for the current used unit for a unit group. More...
 
String GetCurrentUnitCaption (String &unitGroupName)
 Returns the name of the current used unit for a unit group. More...
 
CutListGetCutList ()
 Returns a CutList object. More...
 
String GetDescription ()
 Returns the description. More...
 
int GetDimension ()
 Returns the model dimension. More...
 
PointGetEdgeEndPosition (int edgeId)
 Returns the end point of an edge. More...
 
PointGetEdgeMidPosition (int edgeId)
 Returns the center point of an edge. More...
 
PointGetEdgeStartPosition (int edgeId)
 Returns the start point of an edge. More...
 
ParametricEquationGetEquation (Variant &indexOrName)
 Returns a parametric equation object by specifying its name or index. More...
 
double GetFaceArea (int faceId)
 Returns the area of the specified face. More...
 
PointGetFaceCentroidPosition (int faceId)
 Returns the centroid of a face. More...
 
PointGetFaceNormalVector (int faceId)
 Returns the normal vector of the specified face. More...
 
String GetFilename ()
 Returns the file name of the model. More...
 
GroupListGetGroupList ()
 Returns a GroupList object. More...
 
ModelCenteringGetModelCentering ()
 Returns the ModelCentering object. More...
 
String GetName ()
 Returns the name of the model as a string. More...
 
ParameterSettingStatusGetParameterSettingStatus ()
 Returns a ParameterSettingStatus object to specify the display status of the analysis parameter list. More...
 
PartGetPart (Variant &var)
 Returns the Part object by specifying an index or name. More...
 
PartGetPartByIndex (int index)
 Returns the Part object by specifying a index. More...
 
PartGetPartByPosition (Point *p)
 Returns the Part object that exists on the position of the specified Point object. More...
 
Variant GetPartIDs ()
 Returns the part ID list. More...
 
String GetPartName (int partId)
 Returns a part name by specifying the part ID. More...
 
ReferenceTargetListGetReferenceTargetList ()
 Returns the reference target list. More...
 
ResultViewItemListGetResultViewItemList ()
 Returns result view list. More...
 
SetListGetSetList ()
 Returns the set list. More...
 
StudyGetStudy (Variant &var)
 Returns a Study object by specifying a name or index. More...
 
Variant GetStudyTypeNames ()
 Returns the study type list. More...
 
double GetTransparency (Variant &var)
 Returns the transparency of a part by specifying the name or ID. More...
 
PointGetVertexPosition (int vertexId)
 Returns the position information. More...
 
bool HasCadLink ()
 Returns True as a return value if the model can be linked to a CAD system. More...
 
void ImportAnalysisTemplate (String &filepath, StringList &partnames)
 Imports an analysis template (*.jtmpl) and links the template to a CAD model. More...
 
void ImportAnalysisTemplateAuto (String &filepath, StringList &partnames, StringList &setnames)
 Imports an analysis template (*.jtmpl) and links template and CAD model (includes set). More...
 
void ImportAnalysisTemplateMultiParts (String &filepath, StringList &partnames, StringList &setnames, bool renameParts=false, bool renameSets=false, bool onlyAddExistedSets=false, StringList &refnames=StringList(), bool renameRefs=false, bool onlyAddExistedRefs=false, StringList &equationnames=StringList())
 Imports an analysis template (*.jtmpl) and links with CAD model (includes set). More...
 
bool IsCadLinkOpen ()
 Returns True as a return value if a link to a CAD system is established. More...
 
bool IsPartSuppressed (Variant &part)
 Returns the suppressed state of the part. More...
 
bool IsUpdatedModelAvailable ()
 Returns True as a return value if a model can be updated. More...
 
bool IsValid ()
 Returns True if an object is valid. More...
 
double MeasureDistance (String &fromType, Variant &fromID, String &toType, Variant &toID)
 Measures the distance between specified entities. More...
 
double MeasureDistanceFrom (double x, double y, double z, String &toType, Variant &toID)
 Measures the distance between specified coordinates (x, y, z) and an entity. More...
 
double MeasureDistanceFromPoint (Point *p, String &toType, Variant &toID)
 Measures the distance between the specified Point object and an entity. More...
 
double MeasurePointVertexAngle (double x, double y, double z, Variant &fromID, Variant &toID)
 Measures the angle of the specified center point and two points. More...
 
double MeasureVertexAngle (Variant &fromID, Variant &centerID, Variant &toID)
 Measures the angle of the three specified points. More...
 
int NumParts ()
 Returns the number of parts as an integer. More...
 
int NumStudies ()
 Returns the number of studies in the model as an integer. More...
 
void RemoveEquation (Variant &indexOrName)
 Removes a parametric equation. More...
 
void ReplaceCadModel ()
 Replaces the existing model with a model on the CAD software if a link to a CAD system is established.
 
void ReplaceCadModelFromFile (String &filepath)
 Replaces the existing model with a model from the specified file if the existing model is from a CAD file. More...
 
void RestoreCadLink (bool askForSave=true)
 Restores the link to a CAD system.
 
void RestoreCadLinkWithFilePath (String &filepath)
 Restores the link to a CAD system by specifying the file path. More...
 
void RunAllStudies ()
 Runs the all studies of a model in the foreground. Other operations cannot be run in JMAG-Designer while it is running an analysis in the foreground.
 
void RunSelectStudies (String array &studylist)
 
void SetColor (Variant &var, String &color)
 Returns the color of the part by specifying the part ID or part name. More...
 
void SetDescription (String &description)
 Adds description of the model. More...
 
void SetGroupVisibility (Variant &var, bool visibility)
 Displays or hides the part group. More...
 
void SetModelCentering (ModelCentering *centering)
 Performs model centering by specify the ModelCentering object. More...
 
void SetName (String &name)
 Specifies a model name. More...
 
void SetPartName (Variant &var, String &name)
 Specifies a part name by specifying the part ID. More...
 
void SetStudyOrder (Variant &val, int position)
 Changes the order of studies. More...
 
void SetTransparency (Variant &var, double trans)
 Specifies the degree of transparency of the part. More...
 
void SetUnitCollection (Variant &var)
 Applies the unit system from a specified unit name or ID. More...
 
void SetUnitsFromSystem ()
 Applies the unit system from the [Preference] dialog.
 
void SetVisibility (Variant &var, bool visibility)
 Displays or hides a part. More...
 
void SortPartsById ()
 Sorts the treeview of parts so the ID of parts will be in ascending order.
 
void SortPartsByName ()
 Sorts the treeview of parts so the part names will be in ascending order.
 
void SuppressPart (Variant &part, int state)
 Specifies suppression to part. More...
 
ModelUpdateCadModel (bool copyStudies=true)
 Updates a CAD model. More...
 
ModelUpdateCadModelFromFile (String &filepath, bool copyStudies=true)
 Updates a CAD model from a file. More...
 
void WriteModelOutlineJsonFile (String &filename, int divisions)
 Since this is an internal function, it is not officially supported. More...
 

Detailed Description

Model class is used to specify a model.
The class can be called from Application class.
.

Example of calling the class object:

app.GetModel(0)

Member Function Documentation

void Model::AddEquation ( String &  parameterName)

Adds a parametric equation.

Parameters
parameterNameName of the parametric equation
void Model::ApplyAnalysisTemplate ( String &  path,
StringList &  partnames,
StringList &  setnames,
bool  renameParts = false,
bool  renameSets = false,
bool  onlyAddExistedSets = false,
StringList &  refnames = StringList(),
bool  renameRefs = false,
bool  onlyAddExistedRefs = false,
StringList &  equationnames = StringList() 
)

Specifies the analysis template of the tool box and link the template with the CAD model. (includes set).

Parameters
pathPath of Analysis Template in Toolbox
partnamesName or index of the table defined with a link between parts in a template and CAD model
setnamesName or index of the table defined with a link between sets in a template and CAD model
renameParts
True=1 : Rename part name to match part name of template
False=0 : Do not rename part name to match template
renameSets
True=1 : Rename set name to match template
False=0 : Do not rename set name to match template
onlyAddExistedSets
True=1 : only add sets existed in model
False=0 : add empty sets if they are not existed in model
refnamesName or index of the table defined with a link between refrence targets in a template and CAD model
renameRefs
True=1 : Rename reference target name to match template
False=0 : Do not rename reference target name to match template
onlyAddExistedRefs
True=1 : only add reference targets existed in model
False=0 : add empty reference targets if they are not existed in model
equationnamesName or index of the table defined with a link between equations in a template and CAD model
partnames
Specify the following format when setting tables with the partnames above.
1: Set name of a template (or group part name)
2: Part index of a template (or part group index)
3: Part type of a template (0: Part, 1: Part group)
4: Part name (or part group name) of a CAD model that a template is applied
5: Part index (or part group index) of a CAD model that a template is applied
6: Part type (0: part, 1: part group) of a CAD model that a template is applied
The following commands repeat the number of parts (or number of part group)
The 2nd and 5th index is used when there are multiple parts with the same name.
  • 0 is specified when there are no multiple parts with same name.
  • Numbers higher than 0 are specified when there are multiple parts with the same name.
    For example, 0, 1, and 2 are specified for the indexes of each part when there are three parts with the same name
  • This script can link in group status as long as a type is specified.
    Specify “0” for parts and “1” for part group.
setnames
Specify the following format when setting tables with the set names above.
1: Set name of a template
2: Set index of a template
3: Set type of a template ("part","face","edge","vertex")
4: Set name of a CAD model that a template is applied
5: Set index of a CAD model that a template is applied.
6: Set type of a CAD model that a template is applied ("part","face","edge","vertex")
The following repeats the number of sets
The 2nd and 5th index is used when there are multiple parts with same name.
  • 0 is specified when there are no multiple parts with same name.
  • Numbers higher than 0 are specified when there are multiple parts with the same name.
    For example, 0, 1, and 2 are specified for the indexes of each set when there are three sets with the same name.
    Specify either "Part," "Face," "Edge," or "Vertex" for the set type in row 3 and row 6.
equationnames
Specify the following format when setting tables with the equationnames above.
1: Equation name of a template
2: Equation index of a template
3: Equation name of a CAD model that a template is applied
4: Equation index of a CAD model that a template is applied.
The following repeats the number of equations
void Model::CheckFolderResults ( String &  source)

Loads result files (*.jplot) in the specified folder.

Parameters
sourceFolder path
double Model::ConvertValueFromSI ( String &  unitName,
double  value 
)

Converts value from SI unit to specified unit.

Parameters
unitNameName of the unit to convert to
valueValue to convert
double Model::ConvertValueToSI ( String &  unitName,
double  value 
)

Converts value from specified unit to SI unit.

Parameters
unitNameName of the unit to convert from
valueValue to convert
Study * Model::CopyStudy ( Study study)

Returns a Study object by copying the specified Study object.

Parameters
studyStudy object
Returns
Study object
Selection * Model::Create2DSelection ( )

Creates a Selection object based on 2D model.

Returns
Selection object

The Selection object is used for selection.

void Model::CreateAnalysisTemplate ( String &  title,
String &  tooltip,
String array &  studyList,
String &  folder = String(),
double  version = 1.0 * kProjectFileVersion 
)

Creates an analysis template from the selected studies.

Parameters
titleName of the analysis template
tooltipDescription of the analysis template
studyListList of the specified studies to include in the template
folderFolder of the analysis template
versionsave version
AnalysisTemplateControl * Model::CreateAnalysisTemplateControl ( String &  filepath)

Creates an AnalysisTemplateControl object.

Parameters
filepathPath of template file
Returns
AnalysisTemplateControl object
Selection * Model::CreateSelection ( )

Creates a Selection object.

Returns
Selection object

The Selection object is used for selection.

Study * Model::CreateStudy ( String &  typeName,
String &  name 
)

Creates a study.

Parameters
typeNameStudy type
nameStudy name
Returns
Study object

For more information about the condition type name that can be specified as typeName , see Study Type .
For more information about creating a new iron loss analysis study, see Study::CreateLossStudy() "CreateLossStudy()".

void Model::DeleteStudy ( Variant &  var)

Deletes a study.

Parameters
varStudy name or index
Study * Model::DuplicateStudy ( Variant &  var,
bool  copyPoint = true 
)

Duplicates the study by specifying a name or index.

Parameters
varStudy name or index
copyPoint
True=1 : Copies a point sequence
False=0 : Does not copy a point sequence
Returns
Study object
Study * Model::DuplicateStudyName ( Variant &  var,
String &  name,
bool  copyPoint = true 
)

Duplicates the study by specifying a name or index.

Parameters
varStudy name or index
nameStudy name
copyPoint
True=1 : Copies a point sequence
False=0 : Does not copy a point sequence
Returns
Study object
Study * Model::DuplicateStudyWithCases ( Variant &  var,
String &  name,
String array &  caseList,
String &  children = String(),
bool  copyPoint = true 
)

Duplicates the study by specifying a name or index. In this function, the name of the study to be created and the case to be duplicated can be specified.

Parameters
varStudy name or index
nameStudy name
caseListCase list
childrenIron loss reduction
"none" : Does not copy
"cases" : Copy if Referenced Case Is Copied
copyPoint
True=1 : Copies a point sequence
False=0 : Does not copy a point sequence
Returns
Study object
Study * Model::DuplicateStudyWithType ( Variant &  var,
String &  type,
String &  name = String(),
bool  copyPoint = true 
)

Duplicates the study by specifying a name or index. In this function, the name and type of the study to be created can be specified.

Parameters
varStudy name or index
typeStudy type
nameStudy name
copyPoint
True=1 : Copies a point sequence
False=0 : Does not copy a point sequence
Returns
Study object
void Model::ExportAnalysisParameters ( String &  filename,
bool  exportCADParameter 
)

Exports Analysis Parameter items to designated file.

Parameters
filenameExport file name
exportCADParameterWhether to output CAD parameters
void Model::ExportAnalysisTemplate ( String &  filepath)

Exports a template file (*.jtmpl).

Parameters
filepathFile name of template that is exported
void Model::ExportSelectedAnalysisTemplate ( String &  filepath,
String array &  studyList,
double  version = 1.0 * kProjectFileVersion 
)

Exports a template file (*.jtmpl) including the selected study.

Parameters
filepathFile name of template that is exported
studyListThe study specified to create a template
versionsave version
void Model::ExtendTo3DMesh ( double  length,
int  divisions,
int  studyIndex,
bool  copyStudies = true 
)

Extends 2D region models to a 3D model.

Parameters
lengthHeight of a 3D model
divisionsNumber of element divisions in the extrusion direction
studyIndexStudy index
copyStudies
True=1 : Copies the study to a new model
False=0 : Do not copy the study to a new model

A CAD link needs to be established with the Geometry Editor when running the ExtendTo3DMesh() .

void Model::ExtendTo3DSolid ( double  length,
bool  mergeSameSurface = true 
)

Extends 2D region models to a 3D model.

Parameters
lengthHeight of a 3D model
mergeSameSurface
True=1 : Merges same surface
False=0 : Do not merge same surface

A CAD link needs to be established with the Geometry Editor when running the ExtendTo3DSolid() .

ResultViewItemList * Model::GetAllCasesResultViewItemList ( )

Returns result view list for all cases.

Returns
ResultViewItemList object
String Model::GetColor ( Variant &  var)

Returns the color of the specified part by specifying the name or ID.

Parameters
varPart name or ID
Returns
Color of part
CoordinateSystemList * Model::GetCoordinateSystemList ( )

Returns a CoordinateSystemList object.

Returns
CoordinateSystemList object
String Model::GetCurrentUnit ( String &  unitGroupName)

Returns the key for the current used unit for a unit group.

Parameters
unitGroupNameName of the unit group
String Model::GetCurrentUnitCaption ( String &  unitGroupName)

Returns the name of the current used unit for a unit group.

Parameters
unitGroupNameName of the unit group
CutList * Model::GetCutList ( )

Returns a CutList object.

Returns
CutList object

For more information about the cut plane, see CutPlane and CutList .

String Model::GetDescription ( )

Returns the description.

Returns
Description
int Model::GetDimension ( )

Returns the model dimension.

Returns
Dimension
2D:2
3D:3
Point * Model::GetEdgeEndPosition ( int  edgeId)

Returns the end point of an edge.

Parameters
edgeIDEdge ID
Returns
Point object
Point * Model::GetEdgeMidPosition ( int  edgeId)

Returns the center point of an edge.

Parameters
edgeIDEdge ID
Returns
Point object
Point * Model::GetEdgeStartPosition ( int  edgeId)

Returns the start point of an edge.

Parameters
edgeIDEdge ID
Returns
Point object
ParametricEquation * Model::GetEquation ( Variant &  indexOrName)

Returns a parametric equation object by specifying its name or index.

Parameters
indexOrNameName or index of the parametric equation
Returns
ParametricEquation object
double * Model::GetFaceArea ( int  faceId)

Returns the area of the specified face.

Parameters
faceIdFace ID
Returns
Area of the specified face
Point * Model::GetFaceCentroidPosition ( int  faceId)

Returns the centroid of a face.

Parameters
faceIdFace ID
Returns
Point object
Point * Model::GetFaceNormalVector ( int  faceId)

Returns the normal vector of the specified face.

Parameters
faceIdFace ID
Returns
Point object
String Model::GetFilename ( )

Returns the file name of the model.

Returns
Full path of the model file
GroupList * Model::GetGroupList ( )

Returns a GroupList object.

Returns
GroupList object

For more information about the commands that group parts, see GroupList .

ModelCentering * Model::GetModelCentering ( )

Returns the ModelCentering object.

Returns
ModelCentering object
String Model::GetName ( )

Returns the name of the model as a string.

Returns
Model name
ParameterSettingStatus * Model::GetParameterSettingStatus ( )

Returns a ParameterSettingStatus object to specify the display status of the analysis parameter list.

Returns
ParameterSettingStatus object
Part * Model::GetPart ( Variant &  var)

Returns the Part object by specifying an index or name.

Parameters
varPart ID or name
Returns
Part object

For more information about Part object, see Part and PartGroup .

Part * Model::GetPartByIndex ( int  index)

Returns the Part object by specifying a index.

Parameters
indexPart index
Returns
Part object

For more information about Part object, see Part and PartGroup .

Part * Model::GetPartByPosition ( Point p)

Returns the Part object that exists on the position of the specified Point object.

Parameters
pPoint object
Returns
Part object

For more information about Part object, see Part and PartGroup .

Variant Model::GetPartIDs ( )

Returns the part ID list.

Returns
Part ID list
String Model::GetPartName ( int  partId)

Returns a part name by specifying the part ID.

Parameters
partIdPart ID
Returns
Part name

Part ID can be displayed by selecting [View] > [ID] > [Part] from the JMAG-Designer menubar.

ReferenceTargetList * Model::GetReferenceTargetList ( )

Returns the reference target list.

Returns
ReferenceTargetList object
ResultViewItemList * Model::GetResultViewItemList ( )

Returns result view list.

Returns
ResultViewItemList object
SetList * Model::GetSetList ( )

Returns the set list.

Returns
SetList object
Study * Model::GetStudy ( Variant &  var)

Returns a Study object by specifying a name or index.

Parameters
varStudy name or index
Returns
Study object
Variant Model::GetStudyTypeNames ( )

Returns the study type list.

Returns
List of study types

This list is required to create a new study.

double Model::GetTransparency ( Variant &  var)

Returns the transparency of a part by specifying the name or ID.

Parameters
varPart name or ID
Returns
Transparency of the part
Point * Model::GetVertexPosition ( int  vertexId)

Returns the position information.

Parameters
vertexIdVertex ID
Returns
Point object
bool Model::HasCadLink ( )

Returns True as a return value if the model can be linked to a CAD system.

Returns
Whether or not a model can be linked to a CAD system
void Model::ImportAnalysisTemplate ( String &  filepath,
StringList &  partnames 
)

Imports an analysis template (*.jtmpl) and links the template to a CAD model.

Parameters
filepathPath for template file
partnamesThe name or index of a table that defines the linked parts between the template and the CAD model.
partnames
Describes the table specified with the partnames above in the following format.
1: Part name of template
2: Part index of a template
3: Part name of a CAD model with a template applied
4: Part index of a CAD model with a template applied
The following repeats the number of parts
The 2nd and 4th index is used when there are multiple parts with the same name.
  • 0 is specified when there are no multiple parts with same name
  • Numbers higher than 0 are specified when there are multiple parts with the same name.
    For example, 0, 1, and 2 are specified for the indexes of each part when there are three parts with the same name
  • This script cannot link parts that are grouped.
Example (VBScript):
......
ReDim MatchIdList(23)
MatchIdList(0) = "tempshaft"
MatchIdList(1) = "0"
MatchIdList(2) = "orgshaft"
MatchIdList(3) = "0"
MatchIdList(4) = "tempmagnet"
MatchIdList(5) = "0"
MatchIdList(6) = "orgmagnet"
......
Call model.ImportAnalysisTemplate("foo.jtmpl",MatchIdList)
......
void Model::ImportAnalysisTemplateAuto ( String &  filepath,
StringList &  partnames,
StringList &  setnames 
)

Imports an analysis template (*.jtmpl) and links template and CAD model (includes set).

Templates and CAD models with parts or sets with the same name are automatically linked.

Parameters
filepathPath of template file
partnamesName or index of the table that defines a link between parts in a template and a CAD model
setnamesName or index of the table that defines a link between sets in a template and a CAD model

Settings for a table specified in partnames and setnames do not have to be specified when a part name and set name are the same in a template and a CAD model.

partnames
The table specified with the above partnames are described in the following formats.
1: Part name of a template (or part group name)
2: Part index of a template (or part group index)
3: Part type for template (0: Part, 1: Part group)
4: Part name (or part group name) from a CAD model that a template is applied.
5: Part index (or part group index) of a CAD model that a template is applied.
6: Part type (0: part, 1: part group) of a CAD model that a template is applied.
The following commands repeat the number of parts (or number of part group)
The 2nd and 5th index is used when there are multiple sets with the same name.
  • 0 is specified when there are no multiple parts with same name.
  • Numbers higher than 0 are specified when there are multiple parts with the same name.
    For example, 0, 1, and 2 are specified for the indexes of each part when there are three parts with the same name
  • This script can link in group status as long a type is specified.
    Specify “0” for parts and “1” for part group.
setnames
Specify the following format when setting tables with the setnames above.
1: Set name of template
2: Set index of template
3: Set type of template ("part","face","edge","vertex")
4: Set name of a CAD model that a template is applied
5: Set index of a CAD model that a template is applied.
6: Set type of CAD model that a template is applied ("part","face","edge","vertex")
The following repeats the number of sets
The 2nd and 5th index is used when there are multiple parts with same name.
  • 0 is specified when there are no multiple parts with same name.
  • Numbers higher than 0 are specified when there are multiple parts with the same name.
    For example, 0, 1, and 2 are specified for the indexes of each set when there are three sets with the same name.
    Specify either "Part," "Face," "Edge," or "Vertex" for the set type in row 3 and row 6.
void Model::ImportAnalysisTemplateMultiParts ( String &  filepath,
StringList &  partnames,
StringList &  setnames,
bool  renameParts = false,
bool  renameSets = false,
bool  onlyAddExistedSets = false,
StringList &  refnames = StringList(),
bool  renameRefs = false,
bool  onlyAddExistedRefs = false,
StringList &  equationnames = StringList() 
)

Imports an analysis template (*.jtmpl) and links with CAD model (includes set).

Parameters
filepathPath of template file
partnamesName or index of the table defined with a link between parts in a template and CAD model
setnamesName or index of the table defined with a link between sets in a template and CAD model
renameParts
True=1 : Rename part name to match part name of template
False=0 : Do not rename part name to match template
renameSets
True=1 : Rename set name to match template
False=0 : Do not rename set name to match template
onlyAddExistedSets
True=1 : only add sets existed in model
False=0 : add empty sets if they are not existed in model
refnamesName or index of the table defined with a link between refrence targets in a template and CAD model
renameRefs
True=1 : Rename reference target name to match template
False=0 : Do not rename reference target name to match template
onlyAddExistedRefs
True=1 : only add reference targets existed in model
False=0 : add empty reference targets if they are not existed in model
equationnamesName or index of the table defined with a link between equations in a template and CAD model
partnames
Specify the following format when setting tables with the partnames above.
1: Set name of a template (or group part name)
2: Part index of a template (or part group index)
3: Part type of a template (0: Part, 1: Part group)
4: Part name (or part group name) of a CAD model that a template is applied
5: Part index (or part group index) of a CAD model that a template is applied
6: Part type (0: part, 1: part group) of a CAD model that a template is applied
The following commands repeat the number of parts (or number of part group)
The 2nd and 5th index is used when there are multiple parts with the same name.
  • 0 is specified when there are no multiple parts with same name.
  • Numbers higher than 0 are specified when there are multiple parts with the same name.
    For example, 0, 1, and 2 are specified for the indexes of each part when there are three parts with the same name
  • This script can link in group status as long as a type is specified.
    Specify “0” for parts and “1” for part group.
setnames
Specify the following format when setting tables with the setnames above.
1: Set name of a template
2: Set index of a template
3: Set type of a template ("part","face","edge","vertex")
4: Set name of a CAD model that a template is applied
5: Set index of a CAD model that a template is applied.
6: Set type of a CAD model that a template is applied ("part","face","edge","vertex")
The following repeats the number of sets
The 2nd and 5th index is used when there are multiple parts with same name.
  • 0 is specified when there are no multiple parts with same name.
  • Numbers higher than 0 are specified when there are multiple parts with the same name.
    For example, 0, 1, and 2 are specified for the indexes of each set when there are three sets with the same name.
    Specify either "Part," "Face," "Edge," or "Vertex" for the set type in row 3 and row 6.
equationnames
Specify the following format when setting tables with the equationnames above.
1: Equation name of a template
2: Equation index of a template
3: Equation name of a CAD model that a template is applied
4: Equation index of a CAD model that a template is applied.
The following repeats the number of equations
bool Model::IsCadLinkOpen ( )

Returns True as a return value if a link to a CAD system is established.

Returns
Whether or not the link to a CAD system is established
bool Model::IsPartSuppressed ( Variant &  part)

Returns the suppressed state of the part.

Returns
Whether or not the parts are suppressed
bool Model::IsUpdatedModelAvailable ( )

Returns True as a return value if a model can be updated.

Returns
Whether or not the model can updated
bool Model::IsValid ( )

Returns True if an object is valid.

Returns
Whether or not the Model object is valid
double Model::MeasureDistance ( String &  fromType,
Variant &  fromID,
String &  toType,
Variant &  toID 
)

Measures the distance between specified entities.

Parameters
fromType
Edge : Edge
Vertex : Vertex
Face : Face
fromIDVertex ID, edge ID, face ID
toType
Edge : Edge
Vertex : Vertex
Face : Face
toIDVertex ID, edge ID, face ID
Returns
Distance
double Model::MeasureDistanceFrom ( double  x,
double  y,
double  z,
String &  toType,
Variant &  toID 
)

Measures the distance between specified coordinates (x, y, z) and an entity.

Parameters
xX-Coordinate
yY-Coordinate
zZ-Coordinate
toType
Edge : Edge
Vertex : Vertex
Face : Face
toIDVertex ID, edge ID, face ID
Returns
Distance
double Model::MeasureDistanceFromPoint ( Point p,
String &  toType,
Variant &  toID 
)

Measures the distance between the specified Point object and an entity.

Parameters
pPoint object
toType
Edge : Edge
Vertex : Vertex
Face : Face
toIDVertex ID, edge ID, face ID
Returns
Distance
double Model::MeasurePointVertexAngle ( double  x,
double  y,
double  z,
Variant &  fromID,
Variant &  toID 
)

Measures the angle of the specified center point and two points.

Parameters
xX-Coordinate of the center point
yY-Coordinate of the center point
zZ-Coordinate of the center point
fromIDVertex ID
toIDVertex ID
Returns
Angle
double Model::MeasureVertexAngle ( Variant &  fromID,
Variant &  centerID,
Variant &  toID 
)

Measures the angle of the three specified points.

Parameters
fromIDVertex ID
centerIDVertex ID
toIDVertex ID
Returns
Angle
int Model::NumParts ( )

Returns the number of parts as an integer.

Returns
Number of parts
int Model::NumStudies ( )

Returns the number of studies in the model as an integer.

Returns
Number of studies in the model
void Model::RemoveEquation ( Variant &  indexOrName)

Removes a parametric equation.

Parameters
indexOrNameName or index of the parametric equation
void Model::ReplaceCadModelFromFile ( String &  filepath)

Replaces the existing model with a model from the specified file if the existing model is from a CAD file.

Parameters
filepathThe file path for the updated CAD file
void Model::RestoreCadLinkWithFilePath ( String &  filepath)

Restores the link to a CAD system by specifying the file path.

Parameters
filepathFile path
void Model::RunSelectStudies ( String array &  studylist)
Deprecated:
Runs sequential calculation of the selected studies.
Parameters
studylistStudy index to perform analysis
void Model::SetColor ( Variant &  var,
String &  color 
)

Returns the color of the part by specifying the part ID or part name.

Parameters
varPart name or ID
colorPart color

The colors can be specified with the following.

  • #RGB : 1 hexadecimal digit for R, G, and B respectively
  • #RRGGBB : 2 hexadecimal digits for R, G, and B
  • Black, red etc. : The color names predefined in Windows
void Model::SetDescription ( String &  description)

Adds description of the model.

Parameters
descriptionDescription
void Model::SetGroupVisibility ( Variant &  var,
bool  visibility 
)

Displays or hides the part group.

Parameters
varName or index of the part group
visibility
True=1 : Shows
False=0 : Hides
  • The index in this command is in the display order of the [Project Manager] tree.
Model_SetGroupVisibility_001.gif
void Model::SetModelCentering ( ModelCentering centering)

Performs model centering by specify the ModelCentering object.

Parameters
ModelCenteringobject
void Model::SetName ( String &  name)

Specifies a model name.

Parameters
nameModel name
void Model::SetPartName ( Variant &  var,
String &  name 
)

Specifies a part name by specifying the part ID.

Parameters
varPart ID or name
nameName given to the part

Part ID can be displayed by selecting [View] > [ID] > [Part] from the JMAG-Designer menubar.

void Model::SetStudyOrder ( Variant &  val,
int  position 
)

Changes the order of studies.

Parameters
valModel name or ID
positionStudy position
void Model::SetTransparency ( Variant &  var,
double  trans 
)

Specifies the degree of transparency of the part.

Parameters
varPart name or ID
transTransparency (0 to 1)
void Model::SetUnitCollection ( Variant &  var)

Applies the unit system from a specified unit name or ID.

Parameters
varUnit name or ID
void Model::SetVisibility ( Variant &  var,
bool  visibility 
)

Displays or hides a part.

Parameters
varPart name or ID
visibility
True=1 : Shows
False=0 : Hides
void Model::SuppressPart ( Variant &  part,
int  state 
)

Specifies suppression to part.

Parameters
partPart name or ID
state
True=1 : Suppresses part
False=0 : Clears part suppression
Model * Model::UpdateCadModel ( bool  copyStudies = true)

Updates a CAD model.

Parameters
copyStudies
True=1 : Copies the study to a new model
False=0 : Do not copy the study to a new model
Returns
Model object
Model * Model::UpdateCadModelFromFile ( String &  filepath,
bool  copyStudies = true 
)

Updates a CAD model from a file.

Parameters
filepathThe file path for the updated CAD file
copyStudies
True=1 : Copies the study to a new model
False=0 : Do not copy the study to a new model
Returns
Model object
void Model::WriteModelOutlineJsonFile ( String &  filename,
int  divisions 
)

Since this is an internal function, it is not officially supported.

Deprecated: