group placement

group placement

Anonymous
Not applicable
455 Views
3 Replies
Message 1 of 4

group placement

Anonymous
Not applicable

Hi,

 

I am experiencing a strange behavior. I place a group via code and the group gets rotated on its own. Also when manually pacing the group always a box comes shows up with the cursor prompting the user to place the group but when I prompt the user to place the group via "

Selection.PickPoint("Please pick a point.");

"

no box shows up with the cursor

 

UIDocument uidoc = uiapp.ActiveUIDocument;
                            FilteredElementCollector collector = new FilteredElementCollector(Command.doc).OfClass((typeof(GroupType)));
                            var groupTypes = from element in collector
                                             where element.Name == "test"
                                             select element;
                            Element groupType = groupTypes.First();
                            GroupType ty = (GroupType)groupType;

try
                                {
                            XYZ targetPoint = Command.uidoc.Selection.PickPoint("Please pick a point.");
                            using (Transaction trans = new Transaction(uidoc.Document))
                            {
                                
                                    trans.Start("sun");
                                   Group dt= uidoc.Document.Create.PlaceGroup(targetPoint, ty);
                                 
                                    trans.Commit();
                                
                               
                            }
                                }
                                catch (Exception ex)
                                {
                                   
                                    string ee = ex.ToString();
                                }

 

 

forrevitforum.png

0 Likes
456 Views
3 Replies
Replies (3)
Message 2 of 4

stever66
Advisor
Advisor

No box shows up because you are picking the point before you start the group placement.   Why not try combining 2 lines into a single line of code:

 

Instead of:

 

XYZ targetPoint = Command.uidoc.Selection.PickPoint("Please pick a point.");

 

and;

 

Group dt= uidoc.Document.Create.PlaceGroup(targetPoint, ty);

 

try something like this:

 

Group dt= uidoc.Document.Create.PlaceGroup(Command.uidoc.Selection.PickPoint("Please pick a point."), ty);

0 Likes
Message 3 of 4

Anonymous
Not applicable

Thanks for the reply. But the result was same.

 

Thanks & Regards

Sanjay Pandey

 

0 Likes
Message 4 of 4

Anonymous
Not applicable

was able to tackle the problem. ungrouped the group and created a new group.

 

but still the following problem remails unresolved

 

Also when manually pacing the group always a box comes shows up with the cursor prompting the user to place the group but when I prompt the user to place the group via "

Selection.PickPoint("Please pick a point.");

"

no box shows up with the cursor

0 Likes