MikeEd
Mechanical
- Mar 15, 2009
- 2
Hello
I have been looking how to change the dimension text from within the solidworks api. I can change the value and position no problem but not the displayed text.
I am looking to get the text such as
"4 Holes<MOD-DIAM><DIM> THRU ALL"
The only values I can get is <MOD-DIAM><DIM> but I need to be able to change the comment section.
I've spent hours going through examples and the API help but I can not find a reference.
The code I have got that is accessing the dimension object is as follows. I can access the general dimension name, value, full name, tolerance details just not the dimension text.
//=============================================================
SldWorks swApp = new SldWorks();
ModelDoc2 l_Model;
DrawingDoc l_Draw;
Sheet l_Sheet;
RevisionTableAnnotation l_Revtable;
Dimension dim;
SolidWorks.Interop.sldworks.View l_View;
RevisionTableAnnotation tab;
l_Model = (ModelDoc2)swApp.OpenDoc("PartTwo.SLDDRW"
,(int) swDocumentTypes_e.swDocDRAWING);
l_Draw = (DrawingDoc)l_Model;
l_Sheet = (Sheet) l_Draw.GetCurrentSheet();
l_Revtable = l_Sheet.RevisionTable;
l_Revtable.GetColumnCustomProperty(10);
MessageBox.Show( l_Revtable.GetRevisionForId(10).ToString() );
dim = (Dimension)l_Model.Parameter("RD5@Drawing View6");
MessageBox.Show(dim.FullName);
MessageBox.Show(dim.Value.tostring());
//=============================================
I have been looking how to change the dimension text from within the solidworks api. I can change the value and position no problem but not the displayed text.
I am looking to get the text such as
"4 Holes<MOD-DIAM><DIM> THRU ALL"
The only values I can get is <MOD-DIAM><DIM> but I need to be able to change the comment section.
I've spent hours going through examples and the API help but I can not find a reference.
The code I have got that is accessing the dimension object is as follows. I can access the general dimension name, value, full name, tolerance details just not the dimension text.
//=============================================================
SldWorks swApp = new SldWorks();
ModelDoc2 l_Model;
DrawingDoc l_Draw;
Sheet l_Sheet;
RevisionTableAnnotation l_Revtable;
Dimension dim;
SolidWorks.Interop.sldworks.View l_View;
RevisionTableAnnotation tab;
l_Model = (ModelDoc2)swApp.OpenDoc("PartTwo.SLDDRW"
,(int) swDocumentTypes_e.swDocDRAWING);
l_Draw = (DrawingDoc)l_Model;
l_Sheet = (Sheet) l_Draw.GetCurrentSheet();
l_Revtable = l_Sheet.RevisionTable;
l_Revtable.GetColumnCustomProperty(10);
MessageBox.Show( l_Revtable.GetRevisionForId(10).ToString() );
dim = (Dimension)l_Model.Parameter("RD5@Drawing View6");
MessageBox.Show(dim.FullName);
MessageBox.Show(dim.Value.tostring());
//=============================================