NewAlignment:the two references are not geometrically aligned

NewAlignment:the two references are not geometrically aligned

SimonaQQ
Advocate Advocate
666 Views
2 Replies
Message 1 of 3

NewAlignment:the two references are not geometrically aligned

SimonaQQ
Advocate
Advocate

hello,

How can i achieve the condition of geometrically aligned?

I use the following code to test the newalignment API, but always throw an exception of "the two references are not geometrically aligned". What is the reason? What is "geometrically aligned" mean?

thank you

var uidoc = commandData.Application.ActiveUIDocument;
                var doc = uidoc.Document;
                var selection = uidoc.Selection;

                using (Transaction tra = new Transaction(doc, "33"))
                {
                    tra.Start();

                    Line line0 = Line.CreateBound(XYZ.Zero, new XYZ(10, 0, 0));
                    Line line1 = Line.CreateBound(new XYZ(0, 10, 0), new XYZ(10, 10, 0));
                    var l = doc.Create.NewDetailCurve(doc.ActiveView, line0);
                    var ll = doc.Create.NewDetailCurve(doc.ActiveView, line1);

                    doc.Regenerate();

                    doc.Create.NewAlignment(doc.ActiveView, new Reference(l), new Reference(ll));

                    tra.Commit();
                }


                return Result.Succeeded;

 

0 Likes
667 Views
2 Replies
Replies (2)
Message 2 of 3

RPTHOMAS108
Mentor
Mentor

RevitAPI.chm for ItemFactoryBase.NewAlignment

 

"These references must be already geometrically aligned (this function will not force them to become aligned)."

 

Your lines need to be parallel and geometrically aligned to start with (overlapping) and then NewAlignment will add a lock alignment between them.

Message 3 of 3

SimonaQQ
Advocate
Advocate
So which rule does the two lines in the code violate?
0 Likes