Can't delete block

Anonymous

Can't delete block

Anonymous
Not applicable

When in part design, I can't delete a block because it says the part contains one or more of its istances.

I tryed to delete one by one all the features of part to find if there were some hidden relations I can't find, but even when I deleted all the features (I have an empty tree) it is not possible to delete the block.

See following screenshot I took.

The block initially contained some sketch objects, at the end I also tryed to delete all the objects to have an empty block (it remains only the reference point).

I really can't figure out how to solve.

 

michelecarlone_0-1628260438531.png

 

0 Likes
Reply
Accepted solutions (1)
1,482 Views
6 Replies
Replies (6)

bradeneuropeArthur
Mentor
Mentor

Read this:

https://forums.autodesk.com/t5/inventor-forum/inventor-sketch-block-will-not-delete/td-p/9511223

Corrupted File!

Regards,

Arthur Knoors

Autodesk Affiliations:

Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!


! For administrative reasons, please mark a "Solution as solved" when the issue is solved !

0 Likes

bradeneuropeArthur
Mentor
Mentor

This will solve with some i-logic code:

Dim a As PartDocument = ThisDoc.Document

MsgBox(a.ComponentDefinition.Sketches.Count)

a.ComponentDefinition.Sketches.Item(1).Delete

Regards,

Arthur Knoors

Autodesk Affiliations:

Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!


! For administrative reasons, please mark a "Solution as solved" when the issue is solved !

0 Likes

bradeneuropeArthur
Mentor
Mentor
Accepted solution

Better first to check the sketch for no Name ""

 

Dim a As PartDocument = ThisDoc.Document

For Each s As Sketch In a.ComponentDefinition.Sketches
	If s.Name = "" Then
	
	s.Delete
	
End If
	Next

Regards,

Arthur Knoors

Autodesk Affiliations:

Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!


! For administrative reasons, please mark a "Solution as solved" when the issue is solved !

Anonymous
Not applicable
Thank you, this fixed the issue.
I added a line in iLogic to double check and it found there was an unnamed sketch.
This was not visible in the feature tree and I wasn't able to rename it to take a look at what it contained, but removing it had allowed to delete the undesired block.
I suggest to correct also the thread you linked above (Read this: https://forums.autodesk.com/t5/inventor-forum/inventor-sketch-block-will-not-delete/td-p/9511223 Corrupted File!) on this same topic because "ditch the file" it is not a good solution, no one wants to "ditch" hours and hours spent on a file.
Many thanks!

Mooser91
Participant
Participant

Hello @bradeneuropeArthur 

thank you very much for your ilogic code. I tried it in my .ipt and it worked fine. But one block still remains. 

If i try to delete  the empty block, the error message appears. 

And there are also some unused parameters, that cant be deleted.

 

Do you have any idea to "repair" that file, that i have attached? 

 

Thank you very much!

 

 

 

 

0 Likes

johnsonshiue
Community Manager
Community Manager

Hi! The ipt file is corrupted. There is a hidden sketch consuming the sketch block. As a result, the block cannot be deleted. If you copy and paste the block to another part, the sketch block can be deleted easily.

Many thanks!



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer
0 Likes