コード例 #1
0
        public bool Init(ObjectId id, Point3d pt)
        {
            Database db = HostApplicationServices.WorkingDatabase;

            using (Transaction tr = db.TransactionManager.StartTransaction())
            {
                try
                {
                    m_Pos = id;

                    RebarPos pos = tr.GetObject(m_Pos, OpenMode.ForRead) as RebarPos;
                    if (pos == null)
                    {
                        return(false);
                    }


                    txtPosMarker.Text = pos.Pos;

                    hit = pos.HitTest(pt);
                }
                catch (System.Exception ex)
                {
                    MessageBox.Show("Error: " + ex.Message, "RebarPos", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(false);
                }
            }

            return(true);
        }
コード例 #2
0
        public bool Init(ObjectId id, Point3d pt)
        {
            Database db = HostApplicationServices.WorkingDatabase;
            using (Transaction tr = db.TransactionManager.StartTransaction())
            {
                try
                {
                    m_Pos = id;

                    RebarPos pos = tr.GetObject(m_Pos, OpenMode.ForRead) as RebarPos;
                    if (pos == null)
                    {
                        return false;
                    }

                    txtPosMarker.Text = pos.Pos;

                    hit = pos.HitTest(pt);
                }
                catch (System.Exception ex)
                {
                    MessageBox.Show("Error: " + ex.Message, "RebarPos", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return false;
                }
            }

            return true;
        }
コード例 #3
0
ファイル: EditPosForm.cs プロジェクト: tevfikoguz/RebarPos
        public bool Init(ObjectId id, Point3d pt)
        {
            Database db = HostApplicationServices.WorkingDatabase;

            using (Transaction tr = db.TransactionManager.StartTransaction())
            {
                try
                {
                    m_Pos = id;

                    RebarPos pos = tr.GetObject(m_Pos, OpenMode.ForRead) as RebarPos;
                    if (pos == null)
                    {
                        return(false);
                    }

                    m_Shape = pos.Shape;

                    txtPosMarker.Text        = pos.Pos;
                    txtPosCount.Text         = pos.Count;
                    cbPosDiameter.Text       = pos.Diameter;
                    txtPosSpacing.Text       = pos.Spacing;
                    txtPosMultiplier.Text    = pos.Multiplier.ToString();
                    chkIncludePos.Checked    = pos.IncludeInBOQ;
                    txtPosMultiplier.Enabled = pos.IncludeInBOQ;
                    txtPosNote.Text          = pos.Note;

                    txtA.Text = pos.A;
                    txtB.Text = pos.B;
                    txtC.Text = pos.C;
                    txtD.Text = pos.D;
                    txtE.Text = pos.E;
                    txtF.Text = pos.F;

                    chkShowLength.Checked = (pos.Display == RebarPos.DisplayStyle.All);

                    // Note text alignment
                    rbAlignNoteTop.Checked    = (pos.NoteAlignment == RebarPos.SubTextAlignment.Top);
                    rbAlignNoteBottom.Checked = (pos.NoteAlignment == RebarPos.SubTextAlignment.Bottom);
                    rbAlignNoteRight.Checked  = (pos.NoteAlignment == RebarPos.SubTextAlignment.Right);

                    // Length text alignment
                    rbAlignLengthTop.Checked    = (pos.LengthAlignment == RebarPos.SubTextAlignment.Top);
                    rbAlignLengthBottom.Checked = (pos.LengthAlignment == RebarPos.SubTextAlignment.Bottom);
                    rbAlignLengthRight.Checked  = (pos.LengthAlignment == RebarPos.SubTextAlignment.Right);

                    boundDimensions = pos.GetBoundDimensions().Select(p => p.Id).ToList();

                    if (!SetGroup())
                    {
                        return(false);
                    }
                    if (!SetShape())
                    {
                        return(false);
                    }

                    UpdateLength();

                    hit = pos.HitTest(pt);
                }
                catch (System.Exception ex)
                {
                    MessageBox.Show("Error: " + ex.Message, "RebarPos", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(false);
                }
            }

            return(true);
        }
コード例 #4
0
ファイル: EditPosForm.cs プロジェクト: oozcitak/RebarPos
        public bool Init(ObjectId id, Point3d pt)
        {
            Database db = HostApplicationServices.WorkingDatabase;
            using (Transaction tr = db.TransactionManager.StartTransaction())
            {
                try
                {
                    m_Pos = id;

                    RebarPos pos = tr.GetObject(m_Pos, OpenMode.ForRead) as RebarPos;
                    if (pos == null)
                    {
                        return false;
                    }

                    m_Shape = pos.Shape;

                    txtPosMarker.Text = pos.Pos;
                    txtPosCount.Text = pos.Count;
                    cbPosDiameter.Text = pos.Diameter;
                    txtPosSpacing.Text = pos.Spacing;
                    txtPosMultiplier.Text = pos.Multiplier.ToString();
                    chkIncludePos.Checked = pos.IncludeInBOQ;
                    txtPosMultiplier.Enabled = pos.IncludeInBOQ;
                    txtPosNote.Text = pos.Note;

                    txtA.Text = pos.A;
                    txtB.Text = pos.B;
                    txtC.Text = pos.C;
                    txtD.Text = pos.D;
                    txtE.Text = pos.E;
                    txtF.Text = pos.F;

                    chkShowLength.Checked = (pos.Display == RebarPos.DisplayStyle.All);

                    // Note text alignment
                    rbAlignNoteTop.Checked = (pos.NoteAlignment == RebarPos.SubTextAlignment.Top);
                    rbAlignNoteBottom.Checked = (pos.NoteAlignment == RebarPos.SubTextAlignment.Bottom);
                    rbAlignNoteRight.Checked = (pos.NoteAlignment == RebarPos.SubTextAlignment.Right);

                    // Length text alignment
                    rbAlignLengthTop.Checked = (pos.LengthAlignment == RebarPos.SubTextAlignment.Top);
                    rbAlignLengthBottom.Checked = (pos.LengthAlignment == RebarPos.SubTextAlignment.Bottom);
                    rbAlignLengthRight.Checked = (pos.LengthAlignment == RebarPos.SubTextAlignment.Right);

                    boundDimensions = pos.GetBoundDimensions();

                    if (!SetGroup())
                    {
                        return false;
                    }
                    if (!SetShape())
                    {
                        return false;
                    }

                    UpdateLength();

                    hit = pos.HitTest(pt);
                }
                catch (System.Exception ex)
                {
                    MessageBox.Show("Error: " + ex.Message, "RebarPos", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return false;
                }
            }

            return true;
        }