Fonts and obsolete error

Hey all

keep getting this annoying error to use dimstyle instead of font but when i use dimstyles I get the same error to use dimstyles… I cant find an example fo the correct usage?

var font_index = RhinoDoc.ActiveDoc.DimStyles.Document.Fonts.FindOrCreate(“Arial Bold”, true, false) ;

The documentation of FindOrCreate says that it will use the current dimstyle and set it to the font with given settings.

So to rework that with the given direction: Use DimStyleTable.Current Property (doc.DimStyles.Current) and set DimensionStyle.Font Property to the Font Class you want if it isn’t already the correct one.

Do head the extra WARNING too: don’t use RhinoDoc.ActiveDoc. In your command implementation of RunCommand you are passed in a RhinoDoc instance - use that instead.

Thanks, ill give that a shot and see how I go.

If you need to create a new dimstyle if the font is incorrect and you don’t want to actually change the current dimstyle you can always just get the current dimstyle, then DimensionStyle.Duplicate Method it, adjust that new dimstyle font and add it to the dimstyles table.

thanks. I just need to specify that font as it does nto have loops and all the other nonsense windows fonts have. And text entity needs the font index… i see now it ALSO has a warning that its deprecated aswell…

The code is copied from a grasshopper def and all it does is accept a string and extrude it…

ill poke around a bit more.

On the text entity just set the Font property. And creating extrusions from a text entity you can do with TextEntity.CreateExtrusions Method . That takes a dimstyle, which probably gives you a means to specify a certain font that potentially is different than the one you set to the text entity Font property.