Scaling Multiple Bodies

Scaling Multiple Bodies

Anonymous
Not applicable
1,276 Views
8 Replies
Message 1 of 9

Scaling Multiple Bodies

Anonymous
Not applicable

Hello,

 

I have downloaded a STEP file assembly with multiple parts, and I am trying to scale the bodies down.  However, when I scale the objects down, they all move apart and are not in the same positions relative to one another.  Each part moves in a different direction.  I suspect that the parts are not scaling down with respect to the same origin point.  Is there any way to group the objects together before scaling or scale them down relative to the same point?  Thank you.

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

jhackney1972
Consultant
Consultant

You should attach your model or the STP file so others can troubleshoot your issue.

John Hackney, Retired
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

Message 3 of 9

swerecon
Participant
Participant

Hi, old one but i have the same problem. Adding a file for people to look into. I want to scale it down from 1:1 to 1:13,5 uniform but parts spread all over the screen 🙂 Bet it´s about Orign but is there a way to solve it? i know there are some minor parts missing from the start.

0 Likes
Message 4 of 9

TrippyLighting
Consultant
Consultant
Accepted solution

There are two keys to do this successfully.

 

1. Recently, the "Ground/Unground to/from parent" was introduced. Fusion now applies this by default when importing assemblies. You'll have to go through the entire assembly and select all of those components, right-click, and select "unground from parent". Very tedious!

 

TrippyLighting_0-1717945919919.png

 

2. When you select components to be scaled, Fusion selects some geometric/volumetric center automatically as the point to scale about. You can click the little X to the left of that field do delete that selection and then select a point of your choosing, for example the global origin. 


EESignature

0 Likes
Message 5 of 9

swerecon
Participant
Participant

Thanks for responding. I will try this and hope it solve the problem.

0 Likes
Message 6 of 9

swerecon
Participant
Participant

Update, this tip solved my problem. Thanks for helping

0 Likes
Message 7 of 9

TrippyLighting
Consultant
Consultant

Please don't use the quick reply at the bottom of a thread. Reply to an individual post.


EESignature

0 Likes
Message 8 of 9

dp46BFL
Observer
Observer

Hi ,

 

I made a small Python script to unlock all components in the assembly, maybe it helps someone.

 

 

import adsk.core, adsk.fusion, traceback

def run(context):
    ui = None
    try:
        app = adsk.core.Application.get()
        ui = app.userInterface
        design = app.activeProduct
        rootComp = design.rootComponent
        allOccurrences = rootComp.allOccurrences

        limit = 100000  # Limite pour le débogage
        count = 0
        ungrounded_count = 0

        for occ in allOccurrences:
            if count >= limit:
                break
            if occ.isGroundToParent:
                occ.isGroundToParent = False
                ungrounded_count += 1
            count += 1

        ui.messageBox(f'Total components ungrounded: {ungrounded_count} out of {count} processed components.')

    except Exception as e:
        if ui:
            ui.messageBox(f'Failed:\n{traceback.format_exc()}')
            ui.messageBox(f'Error details: {str(e)}')

 

i have still a problem when I try to scale an assembly , 

 

It almost works but if y have an instance of the same component sometimes is messed up, after one day of research i found if a copy and "paste new" (breaking the instance) it works, but i want to keep the instance to avoid have hundred of the same geometry when i import inside unreal. also, i have thousands of components it will take me a day to separate all the instances, do you have tips on how can i scale keep the instance or in last resort how can i broke all the instances  

 

dp46BFL_0-1728720902266.png

i wish you a beautiful day

best regards

Daniel

0 Likes
Message 9 of 9

dp46BFL
Observer
Observer

hi 

i create i new script to break the link between instances if there are more than 2 the same occurrence.

 

so to scale all your assembly :
1) execute the first script ( this remove all groundLock )

2) execute this script (it copies and paste new all sub assembly containing only component )

3) select the root of your assembly 

4) click scale on the menu 

5) on the pivot (use the delete on the right ) and select the first point of origin (0,0,0) of your assembly

6) choose your scaling 

PS . this is breaking the instance if you are a tip when I can keep it it will be nice 

 

import adsk.core, adsk.fusion, traceback
from collections import defaultdict

def is_leaf_assembly(occurrence):
    """Vérifie si l'occurrence est un sous-assemblage sans sous-assemblages enfants."""
    return all(child.component.occurrences.count == 0 for child in occurrence.childOccurrences)

def run(context):
    ui = None
    try:
        app = adsk.core.Application.get()
        ui  = app.userInterface
        design = adsk.fusion.Design.cast(app.activeProduct)

        if not design:
            ui.messageBox('Aucun design actif.')
            return

        rootComp = design.rootComponent

        # Dictionnaire pour regrouper les occurrences par entityToken du composant
        assembly_occurrences = defaultdict(list)

        # Parcourir toutes les occurrences
        for occ in rootComp.allOccurrences:
            # Vérifier si l'occurrence est un sous-assemblage sans sous-assemblages enfants
            if occ.component.occurrences.count > 0 and is_leaf_assembly(occ):
                assembly_occurrences[occ.component.entityToken].append(occ)

        # Liste pour stocker les noms des assemblages traités
        processed_assemblies = []

        # Pour chaque groupe d'occurrences du même composant
        for token, occ_list in assembly_occurrences.items():
            if len(occ_list) > 1:
                original_comp = occ_list[0].component
                comp_name = original_comp.name
                processed_assemblies.append(f"{comp_name} - {len(occ_list)}")

                # Garder la première occurrence telle quelle, traiter les autres
                for occ in occ_list:
                    original_comp = occ.component
                    # Obtenir le composant parent de l'occurrence
                    if occ.assemblyContext:
                        parent_comp = occ.assemblyContext.component
                    else:
                        parent_comp = rootComp

                    # Faire une copie de la transformation
                    transform_copy = occ.transform.copy()

                    # Créer une nouvelle copie du composant dans le parent
                    new_occ = parent_comp.occurrences.addNewComponentCopy(original_comp, transform_copy)
                    if new_occ:
                        # Supprimer l'ancienne occurrence
                        occ.deleteMe()
                    else:
                        ui.messageBox(f"Échec lors de la création d'une copie pour {comp_name}")
                        return

        # Afficher la liste des assemblages traités
        if processed_assemblies:
            assemblies_list = '\n'.join(processed_assemblies)
            ui.messageBox(f"Les liens d'instance ont été cassés pour les assemblages suivants :\n\n{assemblies_list}")
        else:
            ui.messageBox("Aucun assemblage n'a plusieurs occurrences à traiter.")

    except:
        if ui:
            ui.messageBox('Échec :\n{}'.format(traceback.format_exc()))

 

0 Likes