Continue to Site

Welcome to MCAD Central

Join our MCAD Central community forums, the largest resource for MCAD (Mechanical Computer-Aided Design) professionals, including files, forums, jobs, articles, calendar, and more.

ToolkitBadInputs Exception in J-Link

ssnivas

New member
Hi,


I have written the followingJ-Link codewhich is throwing ToolkitBadInputs exception at the bold line location


------------------------------------------------------------ ----------------------


String stdpath = "C:/ProeModel/FINAL DATA/";
ModelDescriptor descr = null;
Model model = null;
String inputValue ="";
boolean interactFlag = false;
Matrix3D identityMatrix = null;
Transform3D transf = null;
Assembly assembly = null;
Solid componentModel = null;
try {&nbsp ;
identityMatrix = Matrix3D.create ();
for (int x = 0; x <4; x++)
for (int y = 0; y <4; y++){
if (x == y)
identityMatrix.set (x, y, 1.0);
else
identityMatrix.set (x, y, 0.0);
}
transf = pfcBase.Transform3D_Create (identityMatrix);
inputValue = session.UIReadStringMessage(new Boolean(false));
inputValue=stdpath+inputValue;
descr = pfcModel.ModelDescriptor_CreateFromFileName(inputValue);
descr.SetPath (stdpath);
}
catch (jxthrowable x) {
l.write("Error in initializing model descriptor"+x);
}
try {&nbsp ;
model = session.RetrieveModel(descr);
if (model == null || model.GetType() != ModelType.MDL_ASSEMBLY)
l.write("assembly is null");
assembly = (Assembly) model;
componentModel = (Solid)session.GetModelFromDescr (descr);
if (componentModel == null){
l.write("componentModel is null");
componentModel = (Solid) session.RetrieveModel (descr);


}
}
catch (jxthrowable x) {
l.write("Exception in retrieving model:"+x);
}

try {
String [] asmDatums = {"ASM_D_FRONT", "ASM_D_TOP", "ASM_D_RIGHT"};
String [] compDatums = {"COMP_D_FRONT","COMP_D_TOP","COMP_D_RIGHT"};

ComponentFeat asmcomp = (ComponentFeat) assembly.AssembleComponent (componentModel,transf);
ComponentConstraints constrs = ComponentConstraints.create ();
for (int i = 0; i < 3; i++){
ModelItem asmItem = assembly.GetItemByName (ModelItemType.ITEM_SURFACE,asmDatums );
if (asmItem == null){
interactFlag = true;
continue;
}
ModelItem compItem = componentModel.GetItemByName (ModelItemType.ITEM_SURFACE,compDatums );
if (compItem == null){
interactFlag = true;
continue;
}


intseq ids = intseq.create ();
Compon entPath path = pfcAssembly.CreateComponentPath (assembly,ids);
Select ion asmSel = pfcSelect.CreateModelItemSelection (asmItem, path);
Select ion compSel = pfcSelect.CreateModelItemSelection (compItem, null);
Compon entConstraint constr = pfcComponentFeat.ComponentConstraint_Create(ComponentConstra intType.ASM_CONSTRAINT_ALIGN);
constr.SetAssemblyReference (asmSel);
constr.SetComponentReference (compSel);
constrs.insert (constrs.getarraysize(), constr);
}
asmcomp.SetConstraints (constrs, null);
assembly.Regenerate (null);
session.GetModelWindow (assembly).Repaint();
if (interactFlag){
session.UIDisplayMessage ("jlexamples.txt","JLEX Unable to locate all required datum references.New component is packaged.", null);
asmcomp.RedefineThroughUI();
}
model.Display();
}catch (jxthrowable x) {
l.write("Error in initializing model descriptor"+x);
}


------------------------------------------------------------ -----------


Please let me know what is the problem with the transf object (Transform3D).


Thanks,


srinivas
 

Sponsor

Back
Top