iLogic - Delete Center Of Gravity symbols

iLogic - Delete Center Of Gravity symbols

Anonymous
Not applicable
986 Views
16 Replies
Message 1 of 17

iLogic - Delete Center Of Gravity symbols

Anonymous
Not applicable

Hi,

 

I would like a code to delete all Center Of Gravity symbols (only in active sheet).

 

Any suggestions? Thanks!

0 Likes
987 Views
16 Replies
Replies (16)
Message 2 of 17

Anonymous
Not applicable

That should work:

Dim oDoc As Drawingdocument = ThisDoc.Document
Dim oSheet As Sheet = oDoc.ActiveSheet
Dim oCenterMark As Centermark

For Each oCenterMark In oSheet.Centermarks
	If oCenterMark.CenterMarkType = CentermarkTypeEnum.kCenterOfGravityCentermarkType Then
		oCenterMark.Delete
	End If
Next

 

0 Likes
Message 3 of 17

Stakin
Collaborator
Collaborator

Try this

Dim oDrawingDoc As DrawingDocument
oDrawingDoc = ThisApplication.ActiveDocument 
Dim oSheet As Sheet
	oSheet = oDrawingDoc.ActiveSheet
Dim CenterMark As Centermark
For Each CenterMark In oSheet.Centermarks
	If CenterMark.CentermarkType = Inventor.CentermarkTypeEnum.kCenterOfGravityCentermarkType Then
		CenterMark.Delete()  
End If
Next

Before run the rule:

20201130.JPG

After run

20201130A.JPG

 

Message 4 of 17

Anonymous
Not applicable

Hi, I mean this symbol. Maybe it is called something else than Center of gravity?

 

COG.PNG

0 Likes
Message 5 of 17

Anonymous
Not applicable

This is Origin Indicator (for Ordinate Dimensions).

You can hide it:

Dim oDoc As DrawingDocument = ThisDoc.Document
Dim oSheet As Sheet = oDoc.ActiveSheet
Dim oView As DrawingView

For Each oView In oSheet.DrawingViews
	If oView.OriginIndicator Is Nothing
	Else
		oView.OriginIndicator.Visible = False
	End If
Next

 

Message 6 of 17

Anonymous
Not applicable

Hi tomasz

 

I tried this code, but symbol is still there after I run the code.

0 Likes
Message 7 of 17

Anonymous
Not applicable

Can you attach files?

Drawing and corresponding model?

0 Likes
Message 8 of 17

Anonymous
Not applicable

It is classified documents unfortunately. Thanks for your help. I will try to figure it out 🙂

0 Likes
Message 9 of 17

Anonymous
Not applicable

Can you show what happens when you right-click this symbol?

What appears?

0 Likes
Message 10 of 17

Anonymous
Not applicable

This: 

 

Capture.PNG

 

 

0 Likes
Message 11 of 17

Anonymous
Not applicable

It looks like a sketch. A symbol drawn in sketch of the view.

Try double-clicking on in - it should trigger sketch editing.

If so, we can delete all sketches but that can delete also other things.

0 Likes
Message 12 of 17

Anonymous
Not applicable

Yes, if I delete the sketch then the symbol will also be deleted.

 

Is it possible to code that all sketches with these symbols will be deleted?

0 Likes
Message 13 of 17

Anonymous
Not applicable

I don't think so.

Please edit this sketch and check what makes this symbol. Is it just circle, lines and filled region? Or maybe some block?

0 Likes
Message 14 of 17

WCrihfield
Mentor
Mentor

Is your drawing document a DWG or an IDW?  If it's a DWG, then is it possible that center of gravity object is an AutoCADBlock object?  If so, you may be able to use iLogic code similar to the following:

(Just change the name of the AutoCADBlock it is looking for within the code to match what yours is called.)

 

Dim oDDoc As DrawingDocument = ThisDrawing.Document
Dim oSheet As Inventor.Sheet = oDDoc.ActiveSheet
For Each oABlock As AutoCADBlock In oSheet.AutoCADBlocks
	'<<<< CHANGE THIS NAME >>>>
	If oABlock.Name = "Center Of Gravity" Then
		oABlock.Delete
	End If
Next

If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click 'LIKE' 👍.

If you have time, please... Vote For My IDEAS 💡and Explore My CONTRIBUTIONS

Inventor 2021 Help | Inventor Forum | Inventor Customization Forum | Inventor Ideas Forum

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 15 of 17

Anonymous
Not applicable

In browser it looks like this: 

 

COG1.PNG

In sketch it looks like this, seems like it is a circle with lines, however I am not able to edit it:

 

COG2.PNG

0 Likes
Message 16 of 17

Anonymous
Not applicable

Is the name of this sketch always "Sketch1"?

Is deleting all sketches an option?

0 Likes
Message 17 of 17

Anonymous
Not applicable

tomasz: It's not always sketch 1. I guess I have to delete it manually then.

 

I would also like to remove the text and leader besides this symbol. I am able to delete the text but not the arrow. I described the issue in the last post here: https://forums.autodesk.com/t5/inventor-customization/ilogic-to-replace-letter-in-text-location-in-d...

0 Likes