Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

TURN OFF VISIBILITY OFF ALL PARTS IN AN AREA

ferrisb
Collaborator

TURN OFF VISIBILITY OFF ALL PARTS IN AN AREA

ferrisb
Collaborator
Collaborator

Greetings All,

I am just getting into iLogic and am wondering if anyone has some suggestions for what I'm working on.

Object:

I often re-size this "box" from 20'x50' to 10'x20' & everything in between.

 

So far I've found that letting the extra stiffeners that are used in the larger configuration but not in the shorter models, stay in the model and just turning off their visibility give me the most re-usable drawing files.

Where as if I control the number of these it's by use of fx in the patterns, I loose my drawing annotations whenever I increase the size.  (When I decrease the size they work fine)

 

Any ideas on how I can get all parts withing a preset fx bounding box, that will change size with my box?

Here is a picture showing going from a 50' long box to a 33' long box.

I simply want to easily turn off the visibility of the now extra stiffeners.

My model parameters are all set up and running well, just looking for the link to iLogic, or possibly VBA that would help with the visibility.

TURN OFF VIS INSIDE AREA.jpg

 

0 Likes
Reply
Accepted solutions (1)
615 Views
7 Replies
Replies (7)

clutsa
Collaborator
Collaborator

I have a couple ideas but first I want to ask...

1: Would you be opposed to your model only expanding in one direction? IE. the front face of your model is always on the front plane and the back side of your model will grow and shrink.

2: Are there parts that are on the left or right that will be in your bounding box or will all parts always be to the front or back?

If I've helped you, please help me by supporting this idea.
Mass Override for Each Model State

Custom Glyph Icon for iMates

0 Likes

bradeneuropeArthur
Mentor
Mentor

@ferrisb

Are you using a pattern for this, or are these parts placed independent?

if you can use a pattern then you can define the Qty of the pattern by the length of the ducting.

do you understand what I suggest?

this is the easiest way and without coding.

but I don't know if this will work for you.

Regards,

Autodesk Software: Inventor Professional 2018 | Vault Professional 2018 | Autocad Mechanical 2018
Programming Skills: Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
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 !

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

ferrisb
Collaborator
Collaborator

Thanks Branden.

Yes, I think I follow and agree with you.

Yes, they are patterns.  Normally I just set the pattern to qty=OAL-or-OAW / STIFF_SPACE.

Where OAL, OAW & STIFF_SPACE are my preset parameters. 

 

This works awesome for the model end of the deal. 

However, when I use this method and resize the box, I loose all drawing annotations when I increase size.

Deceasing size is fine, because the dims just fall off the drawing.

 

I've found that the visibility toggle, will hold the annotations on the drawing when I upsize my project.

 

 

 

 

0 Likes

ferrisb
Collaborator
Collaborator

Thanks Clutsa.

 

1: Would you be opposed to your model only expanding in one direction? IE. the front face of your model is always on the front plane and the back side of your model will grow and shrink.

*I think the model needs to grow evenly in both directions do to the way some of the internals work.

 

2: Are there parts that are on the left or right that will be in your bounding box or will all parts always be to the front or back?

*Nope, when I resize my box, I just want everything inside of it to "visibility on" and all else to "visibility off"

0 Likes

clutsa
Collaborator
Collaborator
Accepted solution

I threw this together but it will need tweaks to match your situation. This base idea is to create a zone to keep (your inside rectangle) and remove anything that is outside that. Use your parameters to set the keep zone and pass those into the TargetAreaMax/Min (I think those are defaulting to cm right now so do math to convert your zone to cm)

Note: I also use the center of the part to find it's place in the assembly. The part may enter or exit the zone... I'm only looking at the center of the part (that might make it feel like its not working at first... just keep playing with is)

Sub VisByLoc()
Dim app As Application
Dim Doc As AssemblyDocument
Dim CompDef As ComponentDefinition
Dim tg As TransientGeometry

Set app = ThisApplication
Set Doc = app.ActiveDocument
Set CompDef = Doc.ComponentDefinition
Set tg = app.TransientGeometry
Dim CenterPoint As Point
Dim TargetAreaMax As Point
Dim TargetAreaMin As Point
Set TargetAreaMax = tg.CreatePoint(100, 150, 100) 'find way to set this yourself
Set TargetAreaMin = tg.CreatePoint(-100, -100, -100) 'find way to set this yourself


For Each occ In CompDef.Occurrences
    Set CenterPoint = FindCenterPoint(occ.RangeBox.MaxPoint, occ.RangeBox.MinPoint)
    If OutsideArea(CenterPoint, TargetAreaMax, TargetAreaMin) = True Then
        Debug.Print (occ.Name & " = Show")
        occ.Visible = True
        'occ.Excluded = False 'play with this too it may work nice with your BOM and your drawing
    Else
        Debug.Print (occ.Name & " = Hide")
        occ.Visible = False
        'occ.Excluded = True 'play with this too
    End If
    'Debug.Print (occ.Name & " - Length: " & occ.Transformation.Translation.Length & " - X: " & occ.Transformation.Translation.x & " - Y: " & occ.Transformation.Translation.y & " - Z: " & occ.Transformation.Translation.Z)
Next


End Sub
Function OutsideArea(CenterPoint As Point, MaxPoint As Point, MinPoint As Point) As Boolean
    Dim OutsideX As Boolean
    Dim OutsideY As Boolean
    Dim OutsideZ As Boolean
    If CenterPoint.x > MaxPoint.x Or CenterPoint.x < MinPoint.x Then
        OutsideX = True
    End If
    If CenterPoint.y > MaxPoint.y Or CenterPoint.y < MinPoint.y Then
        OutsideY = True
    End If
    If CenterPoint.Z > MaxPoint.Z Or CenterPoint.Z < MinPoint.Z Then
        OutsideZ = True
    End If
    If OutsideX + OutsideY + OutsideZ = 0 Then OutsideArea = True Else OutsideArea = False
End Function
Function FindCenterPoint(MaxPoint As Point, MinPoint As Point) As Point
    Dim CenterX As Double
    Dim CenterY As Double
    Dim CenterZ As Double
    CenterX = ((MaxPoint.x - MinPoint.x) / 2) + MinPoint.x
    CenterY = ((MaxPoint.y - MinPoint.y) / 2) + MinPoint.y
    CenterZ = ((MaxPoint.Z - MinPoint.Z) / 2) + MinPoint.Z
    Set tg = ThisApplication.TransientGeometry
    Set FindCenterPoint = tg.CreatePoint(CenterX, CenterY, CenterZ)
End Function

 FYI this is VBA code (as is, I don't believe this will run in iLogic)

If I've helped you, please help me by supporting this idea.
Mass Override for Each Model State

Custom Glyph Icon for iMates

ferrisb
Collaborator
Collaborator

Awesome.

Thanks!

0 Likes

clutsa
Collaborator
Collaborator

FYI Here's a link to a post with similar objective.

https://forums.autodesk.com/t5/inventor-customization/ilogic-or-vba-to-select-via-quot-component-off...

 

Edit: didn't notice this was for the same person. LOL sorry

If I've helped you, please help me by supporting this idea.
Mass Override for Each Model State

Custom Glyph Icon for iMates

0 Likes