Notifications
Clear all

[Closed] SimpleObject – Geometry from Text Shape

Hi!
I am trying to create a SimpleObject that should get the basic mesh from a Text spline. Here is sample code:


plugin simpleObject ObjFromTextShape_plugin_def
name:"ObjFromTextShape"
classID:#(145348,543218)
category:"Scripted Primitives"
( 
	local txtObj

	parameters ParamOFTS rollout:RollOutOFTS
	(
		OFTSheight type:#worldUnits ui:OFTSheight default:0	animatable:true
		OFTSwidth type:#worldUnits ui:OFTSwidth default:0 animatable:true
		OFTSdepth type:#worldUnits ui:OFTSdepth default:0 animatable:true
	)

	rollout RollOutOFTS "Main Parameters"
	(
		spinner OFTSheight 	"Height" 	type:#worldunits 	range:[-1000,1000,0]
		spinner OFTSwidth 	"Width" 	type:#worldunits 	range:[-1000,1000,0]
		spinner OFTSdepth 	"Depth" 	type:#worldunits 	range:[-1000,1000,0]
	)
	
	on buildMesh do
	(
		if (txtObj == undefined) do
			txtObj	= createInstance text
		
		txtObj.text = "Test"
		txtObj.font = "Arial"
		
		convertto txtObj TriMeshGeometry

		mesh = txtObj.mesh

	)
	
	tool create
	(
		on mousePoint click do
		(
			case click of
			(
				1: nodeTM.translation = gridPoint
				3: #stop
			)
		)
	
		on mouseMove click do
		(		
			case click of
			(
				2: (OFTSwidth = gridDist.x; OFTSdepth = gridDist.y)
				3: OFTSheight = gridDist.z
			)
		)
	
	)
)

The problem I can’t work around is that I can’t use my Text object the way I want to. The sample code results in error: No “”convertTo”” function for Text <>

I end up with error in line “mesh = txtObj.mesh” if I remove the convertto line:

  • Cannot get mesh from this object: Text

I think that is because I have created an instance of the Text class instead of a Text object itself. Creating a Text object will result in other strange behaviour where my Parameters gets unavailable and causes Max crashes. Error: Couldn’t find a previously defined paramblock in ObjFromTextShape_plugin_def

Since the documentation about simpleObjects says: “A SimpleObject plug-in must not perform any scene related actions such as creating scene nodes or building modifier stacks.”

That seems not to happen in this example code, but crashes any larger size code I have tested, the convertto command seems to mess with SimpleObject parameter blocks

Is there any other way to from inside a SimpleObject, create, convert and fetch the mesh from a Text shape?

1 Reply

Hi again, there seem to not be any simple solution to this problem.

Does anyone know any software available with a simple Command Prompt interface that could perform the convert from Truetype to .3ds or any other format that is simple to import using maxscript?

If so, then I would be able to call that software using DOScommand to generate the geometry and then import it, and hopefully the lack of performance wouldn’t kill the plug-in usability.

I have heard about an old software called Font3D for stuff like this, is there any other up to date software that could do the same stuff, that is free to use?

Thanks in advance!!