AutoCAD Map 3D Developer
Welcome to Autodesk’s AutoCAD Map 3D Developer Forums. Share your knowledge, ask questions, and explore popular AutoCAD Map 3D Developer topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Custom Autocad Map Dimension Feature

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
schikh
671 Views, 5 Replies

Custom Autocad Map Dimension Feature

schikh
Contributor
Contributor

Hi,

 

I need dimensions objects (like we have in Autocad) to be added to my industry model and that custom feature would be  manipulated like the Dimension in Autocad. Could you give me to information on how to code such feature or even better c++ sample code doing similar things.

 

Thanks,

SChikh

0 Likes

Custom Autocad Map Dimension Feature

Hi,

 

I need dimensions objects (like we have in Autocad) to be added to my industry model and that custom feature would be  manipulated like the Dimension in Autocad. Could you give me to information on how to code such feature or even better c++ sample code doing similar things.

 

Thanks,

SChikh

5 REPLIES 5
Message 2 of 6
fieldguy
in reply to: schikh

fieldguy
Advisor
Advisor

maybe you can get started with a dimension jig?  

 

here is a link to an article from @Anonymous.yuan

https://drive-cad-with-code.blogspot.com/2020/04/jig-with-dimension.html  

0 Likes

maybe you can get started with a dimension jig?  

 

here is a link to an article from @Anonymous.yuan

https://drive-cad-with-code.blogspot.com/2020/04/jig-with-dimension.html  

Message 3 of 6
schikh
in reply to: fieldguy

schikh
Contributor
Contributor

Hi Fieldguy,

 

Your reply interesting, showing the Dimension Jig when editing my point feature is something I will need, do you have an Idea how to permanetly show the Dimension ? This is needed to show distances in an Industry Model map (like in a CAD drawing).

 

Thanks,

SChikh

0 Likes

Hi Fieldguy,

 

Your reply interesting, showing the Dimension Jig when editing my point feature is something I will need, do you have an Idea how to permanetly show the Dimension ? This is needed to show distances in an Industry Model map (like in a CAD drawing).

 

Thanks,

SChikh

Message 4 of 6
fieldguy
in reply to: schikh

fieldguy
Advisor
Advisor

here's a link to another dimension jig - this dimension gets "appended" to the modelspace blocktablerecord.

 

https://forums.autodesk.com/t5/net/jigging-a-dimension-to-follow-mouse/m-p/11954864 

 

if i get time later today i will modify norman's code to add the dimension tot the database.

0 Likes

here's a link to another dimension jig - this dimension gets "appended" to the modelspace blocktablerecord.

 

https://forums.autodesk.com/t5/net/jigging-a-dimension-to-follow-mouse/m-p/11954864 

 

if i get time later today i will modify norman's code to add the dimension tot the database.

Message 5 of 6
fieldguy
in reply to: schikh

fieldguy
Advisor
Advisor
Accepted solution

I was hoping you would solve this yourself.  Below is my interpretation of Norman's Move() method.  If the jig status is OK, add the dimension to the current space.

 public void Move2()
 {
     if (!SelectEntity(out ObjectId entId, out Point3d basePt)) return;
     _entityId = entId;
     _basePoint = basePt;
     _prevPoint = basePt;
     _movingPoint = basePt;
     var offset = GetDimLineOffset(_entityId);
     var dimTextPt = GetMidOffsetPoint(_basePoint, _movingPoint, offset);

     try
     {
         _dim = new AlignedDimension(
             _basePoint,
             _movingPoint,
             dimTextPt,
             "0000",
             _dwg.Database.DimStyleTableId);

         using (var tran = _dwg.TransactionManager.StartTransaction())
         {
             _entity = (Entity)tran.GetObject(_entityId, OpenMode.ForWrite);

             var res = _ed.Drag(this);
             if (res.Status == PromptStatus.OK)
             {
                 var db = _dwg.Database;
                 var cspacebtr = (BlockTableRecord)tran.GetObject(db.CurrentSpaceId, OpenMode.ForWrite);
                 cspacebtr.AppendEntity(_dim);
                 tran.AddNewlyCreatedDBObject(_dim, true);
             }
             else
             {
                 _dim.Dispose();
             }
             tran.Commit();
         }
     }
     finally { }
     _ed.WriteMessage("\nDim added");
 }

 Are you looking for something specific to Map3D?  

0 Likes

I was hoping you would solve this yourself.  Below is my interpretation of Norman's Move() method.  If the jig status is OK, add the dimension to the current space.

 public void Move2()
 {
     if (!SelectEntity(out ObjectId entId, out Point3d basePt)) return;
     _entityId = entId;
     _basePoint = basePt;
     _prevPoint = basePt;
     _movingPoint = basePt;
     var offset = GetDimLineOffset(_entityId);
     var dimTextPt = GetMidOffsetPoint(_basePoint, _movingPoint, offset);

     try
     {
         _dim = new AlignedDimension(
             _basePoint,
             _movingPoint,
             dimTextPt,
             "0000",
             _dwg.Database.DimStyleTableId);

         using (var tran = _dwg.TransactionManager.StartTransaction())
         {
             _entity = (Entity)tran.GetObject(_entityId, OpenMode.ForWrite);

             var res = _ed.Drag(this);
             if (res.Status == PromptStatus.OK)
             {
                 var db = _dwg.Database;
                 var cspacebtr = (BlockTableRecord)tran.GetObject(db.CurrentSpaceId, OpenMode.ForWrite);
                 cspacebtr.AppendEntity(_dim);
                 tran.AddNewlyCreatedDBObject(_dim, true);
             }
             else
             {
                 _dim.Dispose();
             }
             tran.Commit();
         }
     }
     finally { }
     _ed.WriteMessage("\nDim added");
 }

 Are you looking for something specific to Map3D?  

Message 6 of 6
schikh
in reply to: fieldguy

schikh
Contributor
Contributor

Thanks fieldguy, exactly what I was lookin for👍

0 Likes

Thanks fieldguy, exactly what I was lookin for👍

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

Post to forums  

Autodesk Design & Make Report