Dear Mustafa,
Thanks for you time and help. Your code did the trick only with a very very little minor change.
trans.Start("sun"); XYZ targetPoint = Command.uidoc.Selection.PickPoint("Please pick a point."); Group dt = uidoc.Document.Create.PlaceGroup(targetPoint, ty); BoundingBoxXYZ box1 = dt.get_BoundingBox(Command.doc.ActiveView); XYZ p1 = box1.Max.Add(box1.Min) / 2; XYZ p2 = p1.Add(new XYZ(0, 0, 1)); Line ln = Line.CreateBound(p1, p2); // replace 180 with Math.Pi //ElementTransformUtils.RotateElement(Command.doc, dt.Id, ln, Math.Pi);
//Replaced above line with
ElementTransformUtils.RotateElement(Command.doc, dt.Id, ln, rotation defined bu user * Math.PI / 180);
Again a big thank for you. Kudos to you and I will accept your solution as accepted answer. But I want to carry it forward. I am posting a new query in the forum. I which I will be needing your expert suggestion.
Thanks & Regards
Sanjay Pandey(BIM[Revit] Developer)