Hello Experts
I have working code(c#) for change the DimensionTextHeight in drafting.
I have converted the c# code to c++ using online converter ..........
facing single error any one please help me on this.
Error message
left of '->ToArray' must point to class/struct/union/generic type
Error line
NXOpen.Annotations.Dimension dimension = workPart.Dimensions.ToArray()[1];
c# code
=====================================
public static void DimensionHeight()
{
Session theSession = Session.GetSession();
Part workPart = theSession.Parts.Work;
ListingWindow lw = theSession.ListingWindow;
lw.Open();
for (int i = 0; i < workPart.Dimensions.ToArray().Length; i++)
{
DisplayableObject[] objects1 = new DisplayableObject[1];
NXOpen.Annotations.Dimension dimension = workPart.Dimensions.ToArray()[1];
string dimensionType = dimension.GetType().Name;
objects1 = new DisplayableObject[1];
if (dimensionType.Contains("HorizontalDimension"))
{
NXOpen.Annotations.HorizontalDimension HorizontalDimension = (NXOpen.Annotations.HorizontalDimension)dimension;
objects1[0] = HorizontalDimension;
}
else if (dimensionType.Contains("VerticalDimension"))
{
NXOpen.Annotations.VerticalDimension VerticalDimension = (NXOpen.Annotations.VerticalDimension)dimension;
objects1[0] = VerticalDimension;
}
NXOpen.Annotations.EditSettingsBuilder editSettingsBuilder1;
editSettingsBuilder1 = workPart.SettingsManager.CreateAnnotationEditSettingsBuilder(objects1);
NXOpen.Drafting.BaseEditSettingsBuilder[] editsettingsbuilders1 = new NXOpen.Drafting.BaseEditSettingsBuilder[1];
editsettingsbuilders1[0] = editSettingsBuilder1;
workPart.SettingsManager.ProcessForMutipleObjectsSettings(editsettingsbuilders1);
editSettingsBuilder1.AnnotationStyle.LetteringStyle.DimensionTextSize = 1.5;
editSettingsBuilder1.AnnotationStyle.LetteringStyle.AppendedTextSize = 1.5;
editSettingsBuilder1.AnnotationStyle.LetteringStyle.ToleranceTextSize = 1.5;
NXObject nXObject1;
nXObject1 = editSettingsBuilder1.Commit();
editSettingsBuilder1.Destroy();
}
}
=========================================================================
c++ code============================================
static void d()
{
NXOpen::Session *theSession = NXOpen::Session::GetSession();
NXOpen::Part *workPart(theSession->Parts()->Work());
NXOpen::Part *displayPart(theSession->Parts()->Display());
std::vector objects1(1);
NXOpen::Annotations::Dimension *dimension = workPart->Dimensions->ToArray()[1];
NXOpen::Annotations::VerticalDimension *verticalDimension1 = static_cast(dimension);
objects1[0] = verticalDimension1;
NXOpen::Annotations::EditSettingsBuilder *editSettingsBuilder1;
editSettingsBuilder1 = workPart->SettingsManager()->CreateAnnotationEditSettingsBuilder(objects1);
std::vector editsettingsbuilders1(1);
editsettingsbuilders1[0] = editSettingsBuilder1;
workPart->SettingsManager()->ProcessForMultipleObjectsSettings(editsettingsbuilders1);
editSettingsBuilder1->AnnotationStyle()->LetteringStyle()->SetDimensionTextSize(1.5);
editSettingsBuilder1->AnnotationStyle()->LetteringStyle()->SetAppendedTextSize(1.5);
editSettingsBuilder1->AnnotationStyle()->LetteringStyle()->SetToleranceTextSize(1.5);
editSettingsBuilder1->AnnotationStyle()->LetteringStyle()->SetTwoLineToleranceTextSize(1.5);
NXOpen::NXObject *nXObject1;
nXObject1 = editSettingsBuilder1->Commit();
editSettingsBuilder1->Destroy();
}