本文整理汇总了C#中ModelDoc2.GetTitle方法的典型用法代码示例。如果您正苦于以下问题:C# ModelDoc2.GetTitle方法的具体用法?C# ModelDoc2.GetTitle怎么用?C# ModelDoc2.GetTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModelDoc2
的用法示例。
在下文中一共展示了ModelDoc2.GetTitle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: createLinkFromPartModel
// This creates a Link from a Part ModelDoc. It basically just extracts the material properties and saves them to the appropriate fields.
public link createLinkFromPartModel(ModelDoc2 swModel)
{
link Link = new link();
Link.name = swModel.GetTitle();
Link.isFixedFrame = false;
Link.Visual = new visual();
Link.Inertial = new inertial();
Link.Collision = new collision();
//Get link properties from SolidWorks part
IMassProperty swMass = swModel.Extension.CreateMassProperty();
Link.Inertial.Mass.value = swMass.Mass;
double[] moment = swMass.GetMomentOfInertia((int)swMassPropertyMoment_e.swMassPropertyMomentAboutCenterOfMass); // returned as double with values [Lxx, Lxy, Lxz, Lyx, Lyy, Lyz, Lzx, Lzy, Lzz]
Link.Inertial.Inertia.setMomentMatrix(moment);
double[] centerOfMass = swMass.CenterOfMass;
Link.Inertial.Origin.xyz = centerOfMass;
Link.Inertial.Origin.rpy = new double[3] { 0, 0, 0 };
// Will this ever not be zeros?
Link.Visual.Origin.xyz = new double[3] { 0, 0, 0 };
Link.Visual.Origin.rpy = new double[3] { 0, 0, 0 };
Link.Collision.Origin.xyz = new double[3] { 0, 0, 0 };
Link.Collision.Origin.rpy = new double[3] { 0, 0, 0 };
// [ R, G, B, Ambient, Diffuse, Specular, Shininess, Transparency, Emission ]
double[] values = swModel.MaterialPropertyValues;
Link.Visual.Material.Color.Red = values[0];
Link.Visual.Material.Color.Green = values[1];
Link.Visual.Material.Color.Blue = values[2];
Link.Visual.Material.Color.Alpha = 1.0 - values[7];
Link.Visual.Material.name = "material_" + Link.name;
return Link;
}
示例2: URDFExporterPM
//The following runs when a new instance of the class is created
public URDFExporterPM(SldWorks swAppPtr)
{
swApp = swAppPtr;
ActiveSWModel = swApp.ActiveDoc;
Exporter = new URDFExporter(swApp);
Exporter.mRobot = new robot();
Exporter.mRobot.name = ActiveSWModel.GetTitle();
linksToVisit = new List<link>();
docMenu = new ContextMenuStrip();
string PageTitle = null;
string caption = null;
string tip = null;
long options = 0;
int longerrors = 0;
int controlType = 0;
int alignment = 0;
string[] listItems = new string[4];
ActiveSWModel.ShowConfiguration2("URDF Export");
#region Create and instantiate components of PM page
//Set the variables for the page
PageTitle = "URDF Exporter";
//options = (int)swPropertyManagerButtonTypes_e.swPropertyManager_OkayButton + (int)swPropertyManagerButtonTypes_e.swPropertyManager_CancelButton + (int)swPropertyManagerPageOptions_e.swPropertyManagerOptions_LockedPage + (int)swPropertyManagerPageOptions_e.swPropertyManagerOptions_PushpinButton;
options = (int)swPropertyManagerPageOptions_e.swPropertyManagerOptions_OkayButton + (int)swPropertyManagerPageOptions_e.swPropertyManagerOptions_CancelButton + (int)swPropertyManagerPageOptions_e.swPropertyManagerOptions_HandleKeystrokes;
//Create the PropertyManager page
pm_Page = (PropertyManagerPage2)swApp.CreatePropertyManagerPage(PageTitle, (int)options, this, ref longerrors);
//Make sure that the page was created properly
if (longerrors == (int)swPropertyManagerPageStatus_e.swPropertyManagerPage_Okay)
{
setupPropertyManagerPage(ref caption, ref tip, ref options, ref controlType, ref alignment);
}
else
{
//If the page is not created
System.Windows.Forms.MessageBox.Show("An error occurred while attempting to create the " + "PropertyManager Page");
}
#endregion
}