Bones, Attachments?

I am a bit lost here, I’m trying to attach a model to the Client’s View model. I know I have to get the Bones of the model, and I already have the Bone names I want to use…But I don’t know what to do now. I tried looking at Kilburn’s Melonium but that just made it worse. So can anyone tell me a straight forward way of doing this?

And the wiki is almost completely useless for doing this type of thing, all I’ve gotten from it is function names and how to get the names of the Bones.

[lua]id = Entity.LookupBone( name )
pos, ang = Entity.GetBone( id )

id = Entity.LookupAttachment( name )
att = Entity.GetAttachment( name )

print( string.format( “Bone position: %s, Bone angle: %s
Attachment position: %s, Attachment angle: %s”, tostring( pos ), tostring( ang ), tostring( att.Pos ), tostring( att.Ang ) ) )[/lua]

Hope that helps some.

To do the drawing:

Set the cmodel to not draw normally, first

[lua]
function SWEP:ViewModelDrawn( )
–Get the view model ( vm ) and get the bone id ( bone_id )
pos, ang = vm:GetBone( bone_id )

cmodel:SetRenderOrigin( pos )
cmodel:SetRenderAngles( ang )
cmodel:FrameAdvance( FrameTime( ) ) --If it is animated

cmodel:DrawModel( )
end
[/lua]

Fairly straight forward.