No OrdinateDimension.setOrigin()?

No OrdinateDimension.setOrigin()?

jacofiero
Contributor Contributor
454 Views
2 Replies
Message 1 of 3

No OrdinateDimension.setOrigin()?

jacofiero
Contributor
Contributor

I have associative ordinate dimensions attached to a dynamic block which changes in size and position.  When the block is changed, the positions of the leaders are updated correctly, but the origin for the ordinate dimensions is not.

 

The arx class for ordinate dimensions has a method for moving the origin ( AcDbOrdinateDimension.setOrigin() ), but the 2015 OrdinateDimension class does not.  The OrdinateDimension.Origin property is read/write but actually writing a value to it appears to do nothing, so I'm out of ideas.

 

How can this be done?

 

On a side note, why doesn't the managed class reference guide contain any info on the OrdinateDimension class?

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

BKSpurgeon
Collaborator
Collaborator

> How can this be done?

 

Does anybody know the answer to this one?

 

 

 

 

0 Likes
Message 3 of 3

BKSpurgeon
Collaborator
Collaborator
        [CommandMethod("CreateOrdinateDimension")]
        public static void CreateOrdinateDimension()
        {
            // Get the current database
            Document acDoc = Application.DocumentManager.MdiActiveDocument;
            Database acCurDb = acDoc.Database;

            // Start a transaction
            using (Transaction acTrans = acCurDb.TransactionManager.StartTransaction())
            {
                // Open the Block table for read
                BlockTable acBlkTbl;
                acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId,
                                                OpenMode.ForRead) as BlockTable;

                // Open the Block table record Model space for write
                BlockTableRecord acBlkTblRec;
                acBlkTblRec = acTrans.GetObject(acBlkTbl[BlockTableRecord.ModelSpace],
                                                OpenMode.ForWrite) as BlockTableRecord;

                // Create an ordinate dimension
                using (OrdinateDimension acOrdDim = new OrdinateDimension())
                {
                    acOrdDim.UsingXAxis = true;
                    acOrdDim.Origin = new Point3d(5,5, 0);
                 
                    acOrdDim.DefiningPoint = new Point3d(100, 100, 0);
                    acOrdDim.LeaderEndPoint = new Point3d(200, 50, 0);
                    acOrdDim.DimensionStyle = acCurDb.Dimstyle;

                    // Add the new object to Model space and the transaction
                    acBlkTblRec.AppendEntity(acOrdDim);
                    acTrans.AddNewlyCreatedDBObject(acOrdDim, true);
                }

                using (OrdinateDimension acOrdDim = new OrdinateDimension())
                {
                    acOrdDim.UsingXAxis = true;
                    acOrdDim.Origin = new Point3d(50, 50, 50);
                    acOrdDim.DefiningPoint = new Point3d(100, 100, 0);
                    acOrdDim.LeaderEndPoint = new Point3d(450, 50, 0);
                    acOrdDim.DimensionStyle = acCurDb.Dimstyle;

                    // Add the new object to Model space and the transaction
                    acBlkTblRec.AppendEntity(acOrdDim);
                    acTrans.AddNewlyCreatedDBObject(acOrdDim, true);
                }

                // Commit the changes and dispose of the transaction
                acTrans.Commit();
            }
        }

 

Changing the origin property of the ordinate dimension object seemed to work for me.

 

For those searching for the answer in the future.

 

regards

 

BK

0 Likes