Announcements

Starting in December, we will archive content from the community that is 10 years and older. This FAQ provides more information.

Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Create slab shape point at intersection

0 REPLIES 0
Reply
Message 1 of 1
Anonymous
437 Views, 0 Replies

Create slab shape point at intersection

I’m trying to create a slope between to points on two adjacent floors, but I’m having trouble with placing a connecting sub element point on the floors edges.

I have tried by getting the floor’s boundary lines, the line between the two points and then used “Getinsercetion” according to the buildingcoder’s https://thebuildingcoder.typepad.com/blog/2010/06/intersection-between-elements.html

 

Skärmklipp.JPG

This is part of how my code looks like now:

 #region skapa punkt på intersection nytt golv
                                using (Transaction t3 = new Transaction(doc, "TRE"))
                                {
                                    t3.Start();

                                    foreach (ModelLine mline in mLines2)

                                    {

                                        LocationCurve lCurve = mline.Location as LocationCurve;

                                        Line c = lCurve.Curve as Line;

                                        XYZ pt1 = c.GetEndPoint(0);
                                        XYZ pt1_noll = new XYZ(pt1.X, pt1.Y, 0);
                                        XYZ pt2 = c.GetEndPoint(1);
                                        XYZ pt2_noll = new XYZ(pt2.X, pt2.Y, 0);
                                        XYZ rp_noll = new XYZ(rp.X, rp.Y, 0);
                                        XYZ rp2_noll = new XYZ(rp2.X, rp2.Y, 0);

                                        Line line1 = Line.CreateBound(pt1_noll, pt2_noll);
                                        line1.MakeUnbound();
                                        Line line2 = Line.CreateBound(rp_noll, rp2_noll);
                                        line2.MakeUnbound();

                                        XYZ brytpunkt = Getinterseciton(line1, line2);
                                        

                                        string l = form.TextString;
                                        double num = Convert.ToDouble(l);
                                        UV nyr = new UV(rp.X, rp.Y);
                                        UV nyp1 = new UV(brytpunkt.X, brytpunkt.Y);
                                        double a1 = nyr.DistanceTo(nyp1);
                                        double nh1 = rp.Z + a1 * (num / 100) * -1.0;

                                        
                                        
                                        SlabShapeEditor shapeEditor3 = golv2.SlabShapeEditor;
                                        shapeEditor3.DrawPoint(new XYZ(brytpunkt.X, brytpunkt.Y, nh1));
                                        

                                    }
                                    t3.Commit();
                                }
                                #endregion

 

 

 

If I use the line.makeunbound(); it places a point at the intersection BUT as well on other edges on the different floors.

 

Can somebody help me? Sorry in advance if this type of question has been brought up before, I’m really new to coding.

0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report