I would like to duplicate a facestyle, change some of it's properties. And finally, duplicate a material with a new style. As you can see in my sample, I'm missing many values.
Set oSEApp = GetObject(, "Solidedge.application")
Set oSEMatTable = objSE.GetMaterialTable
Set oFaceStyle = DuplicateFaceStyle("MetalUnpainted", "MetalBlue")
Call DuplicateMaterial("SteinlessUnpainted", "SteinlessBlue", "MetalBlue")
Call oSEMatTable.ApplyMaterial(oPart, "SteinlessBlue")
Function SEDuplicateFaceStyle(sOldName, sNewName)
'Return the new FaceStyle object
Set SEDuplicateFaceStyle = ???
Sub SEDuplicateMaterial(sOldName, sNewName, sStyleName)
Dim MatCount, MatList, i
Call oSEMatTable.GetMaterialList(MatCount, MatList)
For i = 1 To MatCount
IF UCase(MatList(i)) = UCase(sOldName)
'Create a new material from the material #i
Call oSEMatTable.AddMaterial(sNewName, ?, ?, sStyleName, ?, ?)
Posted by: Pascal Boivin
Post date: 6/23/2009 8:01:39 AM
To duplicate a facestyle:
You must have a PAR file open. The face style will be created in that PAR file. Maybe you want to open one of your templates to get advantage of that new facestyle in future designs.
With your file open:
'This "copies" a new style from one existing.
set oFaceStyle=oPAR.Facestyles.Add(NewName, OldName)
'I couldn't make AddMaterial work. So the easiest way i foresee to create the new material is to export the materials to an XML file, edit it adding the new material and import the XML again.
There are functions for that:
Posted by: Julian Guillo
Post date: 6/24/2009 3:31:00 AM