insert custom component with reference part position
Insert custom component using the position (startpoint X,Y,Z ; endpoint X.Y,Z)of Tank Panels
//DETAIL APLIACATOR - Aplicar um custome componente tipo DETALHE
#region
private void DETAIL()
{
Model Model = new Model();
ModelObjectEnumerator Objects = Model.GetModelObjectSelector().GetAllObjectsWithType(TSM.ModelObject.ModelObjectEnum.BEAM);
double diametro = 0; // Convert.ToDouble(txtDiameter.Text);
double altura = 0; // Convert.ToDouble(txtHeigth.Text);
string perfil = Convert.ToString(cmbBoxProfile.Text);
double raio = diametro / 2.0;
double SlabOut = Convert.ToDouble(txtSlabSizeOutOfWall.Text);
foreach (Beam obj in Objects)
{
if (obj != null)
{
Beam viga = obj as Beam;
if (viga.Name == "XXXXX")
{
string[] str_diametro = viga.Profile.ProfileString.Split('D');
// viga.Profile.ProfileString.Remove(0, 1);
// MessageBox.Show(str_diametro[1]);
Double.TryParse(str_diametro[1], out diametro);
}
else if (viga.Name == "PANEL" && altura == 0)
{
//double iniciox = viga.StartPoint.X;
TSG.Point pti = viga.StartPoint;
TSG.Point ptf = viga.EndPoint;
//MessageBox.Show(viga.inicio);
CustomPart Duct = new CustomPart();
Duct.Name = "SINGLE-DUCT";
Duct.Number = BaseComponent.CUSTOM_OBJECT_NUMBER;
Duct.Position.Plane = Position.PlaneEnum.MIDDLE;
Duct.Position.PlaneOffset = 10;
Duct.Position.Depth = Position.DepthEnum.MIDDLE;
Duct.Position.DepthOffset = 30;
Duct.Position.RotationOffset = 45;
Duct.Position.Rotation = Position.RotationEnum.TOP;
Duct.SetInputPositions(ptf, pti);
Duct.SetAttribute("single-Duct_st01", "single-Duct_st01"); ;
Duct.Insert();
myModel.CommitChanges();
}
}
}
}
#endregion
//DETAIL APLIACATOR - Aplicar um custome componente tipo DETALHE
#region
private void DETAIL()
{
Model Model = new Model();
ModelObjectEnumerator Objects = Model.GetModelObjectSelector().GetAllObjectsWithType(TSM.ModelObject.ModelObjectEnum.BEAM);
double diametro = 0; // Convert.ToDouble(txtDiameter.Text);
double altura = 0; // Convert.ToDouble(txtHeigth.Text);
string perfil = Convert.ToString(cmbBoxProfile.Text);
double raio = diametro / 2.0;
double SlabOut = Convert.ToDouble(txtSlabSizeOutOfWall.Text);
foreach (Beam obj in Objects)
{
if (obj != null)
{
Beam viga = obj as Beam;
if (viga.Name == "XXXXX")
{
string[] str_diametro = viga.Profile.ProfileString.Split('D');
// viga.Profile.ProfileString.Remove(0, 1);
// MessageBox.Show(str_diametro[1]);
Double.TryParse(str_diametro[1], out diametro);
}
else if (viga.Name == "PANEL" && altura == 0)
{
//double iniciox = viga.StartPoint.X;
TSG.Point pti = viga.StartPoint;
TSG.Point ptf = viga.EndPoint;
//MessageBox.Show(viga.inicio);
CustomPart Duct = new CustomPart();
Duct.Name = "SINGLE-DUCT";
Duct.Number = BaseComponent.CUSTOM_OBJECT_NUMBER;
Duct.Position.Plane = Position.PlaneEnum.MIDDLE;
Duct.Position.PlaneOffset = 10;
Duct.Position.Depth = Position.DepthEnum.MIDDLE;
Duct.Position.DepthOffset = 30;
Duct.Position.RotationOffset = 45;
Duct.Position.Rotation = Position.RotationEnum.TOP;
Duct.SetInputPositions(ptf, pti);
Duct.SetAttribute("single-Duct_st01", "single-Duct_st01"); ;
Duct.Insert();
myModel.CommitChanges();
}
}
}
}
#endregion
Comentários
Enviar um comentário