Create slab shape point at intersection

Anonymous

Create slab shape point at intersection

Anonymous
Not applicable

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 Likes
Reply
442 Views
0 Replies
Replies (0)