public CalculateTransform ( MRhinoViewport vp, IOn3dPoint point, OnXform &xform ) : bool | ||
vp | MRhinoViewport | |
point | IOn3dPoint | |
xform | OnXform | |
Результат | bool |
///<summary> This gets called when when the user runs this command.</summary> public override IRhinoCommand.result RunCommand(IRhinoCommandContext context) { MRhinoGetObject go = new MRhinoGetObject(); go.SetCommandPrompt("Select objects to move"); go.GetObjects(1, 0); if (go.CommandResult() != IRhinoCommand.result.success) { return(go.CommandResult()); } MRhinoXformObjectList list = new MRhinoXformObjectList(); if (list.AddObjects(go, true) < 1) { return(IRhinoCommand.result.failure); } MRhinoGetPoint gp = new MRhinoGetPoint(); gp.SetCommandPrompt("Point to move from"); gp.GetPoint(); if (gp.CommandResult() != IRhinoCommand.result.success) { return(gp.CommandResult()); } RhinoGetTranslation gt = new RhinoGetTranslation(); gt.SetCommandPrompt("Point to move to"); gt.AppendObjects(list); gt.SetBasePoint(gp.Point()); gt.DrawLineFromPoint(gp.Point(), true); gt.GetXform(); if (gt.CommandResult() != IRhinoCommand.result.success) { return(gt.CommandResult()); } OnXform xform = new OnXform(); if (gt.CalculateTransform(gt.View().ActiveViewport(), gt.Point(), ref xform)) { // TODO: do object transformation here. } return(IRhinoCommand.result.success); }
///<summary> This gets called when when the user runs this command.</summary> public override IRhinoCommand.result RunCommand(IRhinoCommandContext context) { MRhinoGetObject go = new MRhinoGetObject(); go.SetCommandPrompt("Select objects to move"); go.GetObjects(1, 0); if (go.CommandResult() != IRhinoCommand.result.success) return go.CommandResult(); MRhinoXformObjectList list = new MRhinoXformObjectList(); if (list.AddObjects(go, true) < 1) return IRhinoCommand.result.failure; MRhinoGetPoint gp = new MRhinoGetPoint(); gp.SetCommandPrompt("Point to move from"); gp.GetPoint(); if (gp.CommandResult() != IRhinoCommand.result.success) return gp.CommandResult(); RhinoGetTranslation gt = new RhinoGetTranslation(); gt.SetCommandPrompt("Point to move to"); gt.AppendObjects(list); gt.SetBasePoint(gp.Point()); gt.DrawLineFromPoint(gp.Point(), true); gt.GetXform(); if (gt.CommandResult() != IRhinoCommand.result.success) return gt.CommandResult(); OnXform xform = new OnXform(); if (gt.CalculateTransform(gt.View().ActiveViewport(), gt.Point(), ref xform)) { // TODO: do object transformation here. } return IRhinoCommand.result.success; }