Ilogic is way too slow

Ilogic is way too slow

michael_janssenCN38L
Advocate Advocate
1,204 Views
8 Replies
Message 1 of 9

Ilogic is way too slow

michael_janssenCN38L
Advocate
Advocate

I have constructed a basket here that is built with an Ilogic code in order to be able to control the parameter "Level of detail" - "high" and "low".

The idea is to reduce the file size of the components in an assembly using this parameter if you don't need all the details. This is a controllable type of Simplify.

The problem is that when I press the parts by hand, the speed is acceptable.

But if ilogic is supposed to do that, it just takes too long.

Are there any suggested solutions?

 

michael_janssenCN38L_0-1716444281107.png

 

0 Likes
Accepted solutions (2)
1,205 Views
8 Replies
Replies (8)
Message 2 of 9

Michael.Navara
Advisor
Advisor
Accepted solution

This is because the part is recalculated after each feature state change. You can suppress/unsuppress features as a single call.

 

Dim part As PartDocument = ThisDoc.Document

Dim features As ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection()
features.Add(Feature.InventorFeature("Hole - length side above 1 - Field 1"))
features.Add(Feature.InventorFeature("Hole - length side middle 1 - Field 1"))
features.Add(Feature.InventorFeature("Hole - length side above 1 - Field 2"))
features.Add(Feature.InventorFeature("Hole - Sketch - length side middle - Field 2"))
features.Add(Feature.InventorFeature("Extrusion - longhole - length side middle - Field 2"))
features.Add(Feature.InventorFeature("Hole - width side above - Field 1"))
features.Add(Feature.InventorFeature("Hole - floor"))
features.Add(Feature.InventorFeature("Extrusion32"))

If Level:of:detail = "low" Then
	part.ComponentDefinition.SuppressFeatures(features)
End If

If Level:of:detail = "hight" Then
	part.ComponentDefinition.UnsuppressFeatures(features)
End If

 

 

But in general. I don't know what is the purpose of this model, but if you want to use this for visualization or as a placeholder, use only appearance of the model instead of full geometry. This is much better for performance.

 

0 Likes
Message 3 of 9

michael_janssenCN38L
Advocate
Advocate

Hi Michael,

great idea and thank you very much. This made it faster.
The idea is to reduce the file size in an assembly. We install approx. 20 to 30 pieces in the assemblies.

The idea is that if I need all the details "high" (for machine design) I can toggle this.

If not, switch this to "low" to improve performance.

 

I don't fully understand your solution? Do you have a file as an example?

Greetings

Michael

0 Likes
Message 4 of 9

michael_janssenCN38L
Advocate
Advocate

I don´t understand:

 

"But in general. I don't know what is the purpose of this model, but if you want to use this for visualization or as a placeholder, use only appearance of the model instead of full geometry. This is much better for performance."

 

can you explain me?

0 Likes
Message 5 of 9

michael_janssenCN38L
Advocate
Advocate

I have extended this code, which works so far (everything is suppressed). But I get an error message that I can't identify.

 

Dim part As PartDocument = ThisDoc.Document

Dim features As ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection()
features.Add(Feature.InventorFeature("Hole - length side above  - Field 1"))
features.Add(Feature.InventorFeature("Hole - width side above - Field 2"))
features.Add(Feature.InventorFeature("Hole - length side middle  - Field 1"))
features.Add(Feature.InventorFeature("Hole - length side above - Field 2"))
features.Add(Feature.InventorFeature("Hole - Sketch - length side middle - Field 2"))
features.Add(Feature.InventorFeature("Extrusion - longhole - length side middle - Field 2"))
features.Add(Feature.InventorFeature("Extrusion - longhole - length side middle - Field 2"))
features.Add(Feature.InventorFeature("Hole - width side above - Field 1"))
features.Add(Feature.InventorFeature("Hole - floor"))
features.Add(Feature.InventorFeature("Extrusion - floor thickness"))
features.Add(Feature.InventorFeature("Hole - latch"))
features.Add(Feature.InventorFeature("Extrusion - width side middle - Field 2"))
features.Add(Feature.InventorFeature("Extrusion - Corner - 1"))
features.Add(Feature.InventorFeature("Extrusion - Corner - 2"))

If Level:of:detail = "low" Then
	part.ComponentDefinition.SuppressFeatures(features) ERROR
End If

If Level:of:detail = "hight" Then
	part.ComponentDefinition.UnsuppressFeatures(features) ERROR
End If

michael_janssenCN38L_0-1716461075635.png

 

 

 

Attached is the corrected file

0 Likes
Message 6 of 9

Michael.Navara
Advisor
Advisor
Accepted solution

You are right. The reason of error is when you try to suppress currently suppressed feature.

 

Dim part As PartDocument = ThisDoc.Document

Dim features As ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection()
features.Add(Feature.InventorFeature("Hole - length side above 1 - Field 1"))
features.Add(Feature.InventorFeature("Hole - length side middle 1 - Field 1"))
features.Add(Feature.InventorFeature("Hole - length side above 1 - Field 2"))
features.Add(Feature.InventorFeature("Hole - Sketch - length side middle - Field 2"))
features.Add(Feature.InventorFeature("Extrusion - longhole - length side middle - Field 2"))
features.Add(Feature.InventorFeature("Hole - width side above - Field 1"))
features.Add(Feature.InventorFeature("Hole - floor"))
features.Add(Feature.InventorFeature("Extrusion32"))

If Level:of:detail = "low" Then
	Dim featuresToSuppress = ThisApplication.TransientObjects.CreateObjectCollection()
	For Each f As PartFeature In features
		If Not f.Suppressed Then featuresToSuppress.Add(f)
	Next

	part.ComponentDefinition.SuppressFeatures(featuresToSuppress) 'NO Error
End If

If Level:of:detail = "hight" Then
	Dim featuresToUnsuppress = ThisApplication.TransientObjects.CreateObjectCollection()
	For Each f As PartFeature In features
		If f.Suppressed Then featuresToUnsuppress.Add(f)
	Next
	part.ComponentDefinition.UnsuppressFeatures(featuresToUnsuppress) ' NO Error
End If

 

 

In attachment is the sample how to use appearance in simplified model. Size is reduced from 7.5MB to 300 kB

MichaelNavara_0-1716533124454.png

 

0 Likes
Message 7 of 9

michael_janssenCN38L
Advocate
Advocate

Hi Michael,

First of all, THANK YOU SO MUCH for your great support.
The code works perfectly.

Now to your suggestion. This Simplify in Inventor is somehow too rough and uncontrollable for us, as it no longer has much to do with the original.

You can't suppress it in a controlled manner. Hence the current attempted way of working. (Hopefully not the wrong way)

As you have probably seen, we can switch between high and low level mode via the model state. Which works very well.

We have many such delivery parts that we receive as step files. Unfortunately, as in this case, they are over 90 MB in size. I got this to 10 MB by building it in Inventor.

Attached is the file with the changes.

And thank you again!

0 Likes
Message 8 of 9

michael_janssenCN38L
Advocate
Advocate

Hello Michael,

 

michael_janssenCN38L_0-1727178365339.png

 

would it be possible (probably) to adapt your code so that all designations with 01 or 03 etc. are suppressed when selecting "Level:of:detail" "height" and "low"

Greetings from Kleve (Germany)

0 Likes
Message 9 of 9

LasseBodilsen
Participant
Participant

Just want to add another thank you to this.  

 

We had a part with 100 features that needed to be either shown or suppressed. including 2 features dependend on the main feature.

The code that was done took up to 20 minutes on a fast computer.  

With your approach it went down to less than 17 sec.  

 

THANK YOU SO MUCH!

0 Likes