Exemplo n.º 1
0
        public void BuildBeam()
        {
            List <ObjectId> objectIds = getLineIds();

            using (Transaction tr = db.TransactionManager.StartTransaction())
            {
                List <Line> lines = objectIds.Select(id => id.GetObject(OpenMode.ForRead) as Line).ToList();

                Autodesk.AdvanceSteel.DocumentManagement.DocumentManager.LockCurrentDocument();
                using (Autodesk.AdvanceSteel.CADAccess.Transaction steelTr = Autodesk.AdvanceSteel.CADAccess.TransactionManager.StartTransaction())
                {
                    foreach (Line line in lines)
                    {
                        if (fields.Any(row => row.Layer == line.Layer))
                        {
                            CSVField row = fields.First(r => r.Layer == line.Layer);

                            createBeam(row, line);
                        }
                    }

                    steelTr.Commit();
                }
                Autodesk.AdvanceSteel.DocumentManagement.DocumentManager.UnlockCurrentDocument();

                tr.Commit();
            }
        }
Exemplo n.º 2
0
        private void createBeam(CSVField row, Line line)
        {
            Autodesk.AdvanceSteel.Geometry.Point3d startPoint = new Autodesk.AdvanceSteel.Geometry.Point3d(line.StartPoint.X, line.StartPoint.Y, line.StartPoint.Z);
            Autodesk.AdvanceSteel.Geometry.Point3d endPoint   = new Autodesk.AdvanceSteel.Geometry.Point3d(line.EndPoint.X, line.EndPoint.Y, line.EndPoint.Z);

            string beamFormat = String.Format("{0}#@§@#{1}", row.Table, row.Section);
            // string beamFormat = "AS-NZS SHS - CF C350#@§@#SHS 100x100x3.0";
            StraightBeam myBeam = new StraightBeam(beamFormat, startPoint, endPoint, Autodesk.AdvanceSteel.Geometry.Vector3d.kXAxis);

            myBeam.WriteToDb();
        }