News:

Interested in some really terrific mobile apps? Visit www.turboapps.com for details.

Main Menu

What are the available properties (and values) for dimensions in SDK?

Started by jrdarrah, July 03, 2022, 03:35:28 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jrdarrah

I'm using C# to add a dimension to a new drawing and would like to alter the text height, arrowhead size, and extension offset.

For text I found how to change the font:

 myText = tcGrs.AddText("Tail= " + Convert.ToString(pointsArray[nbrPoints].y) + "\"", 1.14, 0.12, 0, 0.0625,0, 0.5,0);

            object varPropName = "TextFont";
            object varVal = "Calibri";


            pProps = myText.Properties;
            pProp = pProps.get_Item(ref varPropName);
            pProp.set_Value(1, ref varVal);

in the file tcwapi10.h located in the SDK include folder I found these properties and  their values, however, none seem to be for dimensions.

AVAILABLE PROPERTIES:      DESCRIPTION:
'//"PenColor"            pen color as &H00bbggrr or -3 for by layer, -4 for by block
'//"PenWidth"            pen width as a Double
'//"PenScale"            pen scale as a Double
'//"PenStyle"            pen style as a Integer
'//"BrushColor"            brush color as &H00bbggrr or -3 for by layer, -4 for by block or -5 for by pen
'//"BrushScale"            brush scale as a Double
'//"BrushAngle"            brush angle as a Double
'//"BrushStyle"            brush style as a Double
'//"TextStyle"            flags: &H0000 = regular, &H0001 = italic, &H0002 = bold, &H0004 = strikethru, &H0008 = hidden, &H0040 = allcaps
'//"ScaleSystem"            0 for world, 1 for paper, 2 for device
'//"BrushDrawMode"         brush drawing mode as n Integer
'//"PenAlignment"         pen alignment as a String
'//"HatchCross"            hatch cross as an Integer
'//"Layer"               layer id as an Integer
'//"Info"               info string as a String
'//"TextFont"            text font as a String
'//"TextFormat"            0 for left justify, 1 for center, 2 for right justify
'//"TextSize"            text size as a Double

Where  would I find a similar list for use with a dimension object. Similar to what works with the text font example I cited?

nikkipollard

Dimensions have a lot of properties - I find it quite slow to add a dimension - and then change all the properties individually using the SDK
It seems more efficient to make use of Turbocads Property Value presets.
http://docs.imsidesign.com/projects/TurboCAD-2021/turbocad-2021-user-guide-publication/User-Interface/Object-Properties/#property-value-presets

These are called styles in the SDK.
I don't know how to set up a new Property Value preset(Style) via code - but I can change an existing one.
I just edit the properties of the "Normal Dimensions" Property Value preset. - because there is always one.
Using these styles is a little bit trickier then the Graphics.AddDimensionHorizontal() method. Because there is no Style parameter.
So I use the Regen method to add dimensions - This is the method the macro recorder uses.
Obviously this is vb.net code so you will need to translate - but it works for me.
' access the style
Dim sty As IMSIGX.Styles = tcDraw.Styles("Normal Dimensions")
        Dim props As IMSIGX.Properties = sty.Properties
' change values of the style - this only needs to be done once for all dimensions there is a long list of 'properties in the styles only change the ones you need to change because it seems slow
 
props("$DIMBLK1").Value = 10

'To add the dimension use the relevant Regen method
 Dim grf As IMSIGX.Graphic
        grf = tcDraw.Graphics.Add(11, "TCW25DimLin", False, "Normal Dimensions")
        Dim verts As IMSIGX.Vertices = grf.Vertices
        With verts
            .Add(1, 300, 0, False, False, False, False, False, False)
            .Add(0, 300, 0, False, False, False, True, True, False)
            .Add(300, 300, 0, False, False, False, True, True, False)
            .Add(300, 1450, 0, False, False, False, True, False, False)
            .Add(150, 1450, 0, False, True, False, True, False, False)
            .Add(150, 1450, 0, False, False, False, False, False, False)
        End With


The properties are all in the SDK documentation or you can use the SDK to generate a list of properties for each style.
Or use the macro recorder to see what they are.
To find out where the vertices are supposed to be I have a little macro that numbers the vertices of the first selected graphic

These are the regen names of different dimension types
"TCW25DimLin"
"TCW25DimAng"
"TCW25DimRad"
"TCW25DimDia"
They are all graphic type 11 - most graphics are for some odd reason
Nikki
TC20 platinum, TC 2015 platinum
TC 2017 with lightworks
TC 2021 platinum
Windows 11 Home 22h