DModelPanel (glitchy) or DSpawnIcon (not working)?

Hello, comrades. I want to make a panel that contains model. Previously I was using DModelPanel which looks not good by default. For example:

window = vgui.Create("DModelPanel", pnl)
	window:SetHeight (280)
	window:Dock (TOP)
	window:SetModel (item.model)
	window:SetCamPos (Vector (15, 15, 20) + item.addvec)
	window:SetLookAt (window.Entity:GetPos())
	window:SetEnabled (false)

SetCamPos and SetLookAt help a bit, but some models still go outside the bounds of panel. Seems like the main problem is about center of the model - so the model rotates around it’s corner, not the center (I’m talking about internal rotating animation of panel).
I know no fix for this, so I looked at DSpawnIcon - seems acceptable for me. But I get an error at second line of the code:

local mdl = vgui.Create ("DSpawnIcon", pnl)
		mdl:Dock (FILL)
		mdl:SetModel (sampletable[id].model)

“attempt to index local ‘mdl’ (a nil value)”

I would highly appreciate any help.

It’s “SpawnIcon” not “DSpawnIcon”.

Oh, thank you very much :open_mouth:
Also, do you know anything about “entity centering” inside DModelPanel?