Академический Документы
Профессиональный Документы
Культура Документы
namespace SOLIDWORKSSheetMetalCostingCSharp.csproj
{
ModelDoc2 swModel;
ModelDocExtension swModelDocExt;
CostManager swCosting;
CostPart swCostingPart;
CostBody swCostingBody;
object swCostingModel;
CostAnalysis swCostingAnalysis;
CostAnalysisSheetMetal swCostingSheetMetal;
string sheetmetalCostingTemplatePathName;
string sheetmetalCostingReportTemplateFolderName;
int nbrSheetmetalCostingTemplate;
int nbrCommonCostingTemplate;
object[] commonCostingTemplates;
object[] sheetmetalCostingTemplates;
int nbrCostingBodies;
object[] costingBodies;
string costingBodyName;
int i;
bool isSheetMetalBody;
CostFeature swCostingFeat;
CostFeature swCostingNextFeat;
CostFeature swCostingSubFeat;
CostFeature swCostingNextSubFeat;
TemplateOverrides swTemplateOverrides;
int costingMethod;
swModel = (ModelDoc2)swApp.ActiveDoc;
swModelDocExt = swModel.Extension;
// Get CostingManager
swCosting = (CostManager)swModelDocExt.GetCostingManager();
swCosting.WaitForUIUpdate();
Array.Resize(ref sheetmetalCostingTemplates,
nbrSheetmetalCostingTemplate + 1);
Array.Resize(ref commonCostingTemplates, nbrCommonCostingTemplate + 1);
Debug.Print("Costing templates:");
Debug.Print("");
for (i = 0; i <= (nbrCommonCostingTemplate - 1); i++)
{
Debug.Print(" Name of common Costing template: " +
commonCostingTemplates[i]);
}
Debug.Print("");
Debug.Print("");
if (!isSheetMetalBody )
{
Debug.Print ("");
Debug.Print ("No sheet metal bodies in part! Exiting
macro.");
return;
}
}
}
swCostingSubFeat = (CostFeature)swCostingFeat.GetFirstSubFeature();
while ((swCostingSubFeat != null))
{
Debug.Print(" Subfeature: " + swCostingSubFeat.Name);
Debug.Print(" Type: " + swCostingSubFeat.GetType());
Debug.Print(" Setup related: " +
swCostingSubFeat.IsSetup);
Debug.Print(" Overridden: " +
swCostingSubFeat.IsOverridden);
Debug.Print(" Combined cost: " +
swCostingSubFeat.CombinedCost);
Debug.Print(" Combined time: " +
swCostingSubFeat.CombinedTime);
swCostingNextSubFeat =
(CostFeature)swCostingSubFeat.GetNextFeature();
swCostingSubFeat = null;
swCostingSubFeat = (CostFeature)swCostingNextSubFeat;
swCostingNextSubFeat = null;
}
swCostingNextFeat = swCostingFeat.GetNextFeature();
swCostingFeat = null;
swCostingFeat = (CostFeature)swCostingNextFeat;
swCostingNextFeat = null;
}
/// <summary>
/// The SldWorks swApp variable is pre-assigned for you.
/// </summary>
}
}