public override bool Run(FeatureContext context) { Text3dNode textNode = new Text3dNode(); textNode.SetFontName("FangSong (TrueType)"); textNode.SetText("1234565\nabcdefg\n我爱CAD"); textNode.SetLineSpace(10); Coordinate3 coord = new Coordinate3(); coord.Origion = new Vector3(100, 100, 0); coord.X = new Vector3(1, 1, 0); coord.X.Normalize(); coord.Y = coord.Z.CrossProduct(coord.X); Matrix4 trf = GlobalInstance.MatrixBuilder.ToWorldMatrix(coord); textNode.SetTransform(trf); textNode.Update(); context.ShowSceneNode(textNode); return(true); }
private void text3DToolStripMenuItem_Click(object sender, EventArgs e) { String fontName = "romand.shx"; FontManager fontMgr = GlobalInstance.FontManager; AnyCAD.Platform.Font font = fontMgr.FindFont(fontName); if(font == null) { font = fontMgr.LoadFont(fontName, "..\\Library\\Font\\romand.shx"); if(font != null) fontMgr.AddFont(font); } foreach (String name in fontMgr.ListFontNames()) { //MessageBox.Show(name); } Text3dNode textNode = new Text3dNode(); textNode.SetFontName("FangSong (TrueType)"); textNode.SetText("1234565\nabcdefg\n我爱你"); textNode.SetLineSpace(10); Coordinate3 coord = new Coordinate3(); coord.Origion = new Vector3(100, 100, 0); coord.X = new Vector3(1, 1, 0); coord.X.Normalize(); coord.Y = coord.Z.CrossProduct(coord.X); Matrix4 trf = GlobalInstance.MatrixBuilder.ToWorldMatrix(coord); textNode.SetTransform(trf); textNode.Update(); renderView.ShowSceneNode(textNode); }