Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Drawing dimension

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
marioriva
857 Views, 4 Replies

Drawing dimension

Good afternoon,

 

I need to recognize, via c#, the different types of dimensions (associated (A) or not (B)) as you can see in the attached image. Which is the property? "GeneralDimension.Attached" in my sample doesn't work. is the right property?

How can I do?

 

Thank you.

 

Regards,

 

Mario

Tags (1)
4 REPLIES 4
Message 2 of 5

GeneralDimension.Attached property is expected to indicate if the given dimension is orphaned or not. Could you upload the simplest dataset that reproduces your case?
Thanks


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

Message 3 of 5
marioriva
in reply to: marioriva

My customize command:

- reads the files from directory and copy to another
- changes the values of xls reference
- changes the internal reference
- Updates views in drawing document

- saves the document

- runs the function checkOrphDimension to check and delete orphaned dimensions

 

I use this code:

        /// <summary>
        /// Delete orphaned quote
        /// </summary>
        /// <param name="dwg">drawing document</param>
        private void checkOrphDimension(Inventor._DrawingDocument dwg)
        {
            try
            {

                foreach (Sheet foglio in dwg.Sheets)
                {

                    string nome_foglio = foglio.Name;

                    foreach (Inventor.GeneralDimension quota in foglio.DrawingDimensions.GeneralDimensions)
                    {

                       if (quota.Attached == false)
                           quota.Delete();  
                    }
                }
            }
            catch (Exception ex)
            {

                MessageBox.Show("Error: " + ex.ToString());
            }
        }

 

Attached you can find the drawing.

 

Regards,

 

Mario

Message 4 of 5

It seems that in this case checking the IntentOne or IntentTwo properties will be enough to identify sick dimensions.

If one of these properties produces error you may delete the dimension.

In your drawing I found three sick dimensions. Their model values are:

  • 140 mm 
  • 630 mm 
  • 867.807692307692 mm

Cheers,

 


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

Message 5 of 5

Thank you. It works.

My Orthodox way:

foreach (Inventor.LinearGeneralDimension quota in
foglio.DrawingDimensions.GeneralDimensions)
{

try
{
Object entita;
entita = quota.IntentOne.Geometry;
}
catch (Exception ex)
{
quota.Delete();
}
}


Bye,

Mario

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

Post to forums  

Autodesk Design & Make Report