Delete all dimensions on a drawing with ilogic

Delete all dimensions on a drawing with ilogic

Anonymous
Not applicable
1,769 Views
3 Replies
Message 1 of 4

Delete all dimensions on a drawing with ilogic

Anonymous
Not applicable

Good Day,

 

Does anyone know how to delete all dimensions on a drawing with ilogic/api?

 

I would like to run a rule that deletes all dimensions on a drawing when loaded, then I want to run another rule that populates the drawing with new dimensions referenced from work points on the model.

 

I am able to add new dimensions, but would like to know how to delete all existing dimensions with a rule.

 

 

Thanks 🙂

 

 

0 Likes
Accepted solutions (1)
1,770 Views
3 Replies
Replies (3)
Message 2 of 4

AdamAG99T
Advocate
Advocate
Accepted solution

This bit of code should accomplish what you want. It will delete every drawing dimension on the active sheet. I also added a bit of code to make the entire operation a single undo operation, as it would add each dimension being deleted as it's own entry otherwise.

 

Dim oDoc As DrawingDocument
oDoc = ThisApplication.ActiveDocument
Dim oSheet As Sheet
oSheet = oDoc.ActiveSheet
Dim oDim As DrawingDimension
Dim oTrans As Transaction
oTrans = ThisApplication.TransactionManager.StartTransaction(ThisApplication.ActiveDocument,"Delete")
For Each oDim In oSheet.DrawingDimensions
	oDim.Delete
Next 
oTrans.End

  

Message 3 of 4

Anonymous
Not applicable

Thank You.

 

Worked like a charm!

0 Likes
Message 4 of 4

Ritesh.Gurao
Participant
Participant

Hi, Could you share the code to add dimensions in drawing

0 Likes