I'm trying to set the material for the current model/part using:
part.RetrieveMaterial("steel");
The issue is defining part. Sample code I have found does something like this:
Part part;
this.part = part;Thanks Mark. I'll give this a try. Another solution I got is:
Part part = (Part)model;
Which works but yours also checks for the correct type. Thanks.
In Reply to Mark Stallard:
In the JLink API, Part extends Solid, and Solid extends Model.
In other words, anything that is a Part is also a Model, but
not vice-versa. So, if you have the active model already
assigned to the variable activeModel, and you want to make
sure it's a part, you can do something like this:
ModelType type ;
type = activeModel.GetType() ;
if ( type.equals( ModelType.MDL_PART )) {
this.part = ( Part ) activeModel ;
} else {
// Notify the user that the active model is not a part
}