GithubHelp home page GithubHelp logo

Comments (5)

Pendelf avatar Pendelf commented on June 24, 2024 1

If you drag and drop bodies, everything works fine

from freecad.

maxwxyz avatar maxwxyz commented on June 24, 2024

Does it work when you manually drag both into the assembly object in the tree view?
@PaddleStroke FYI

from freecad.

PaddleStroke avatar PaddleStroke commented on June 24, 2024

This is the same bug as #13780
The issue is that getRootObject is returning the root of dependency graph and not root of the tree. I made this getRootObjectsIgnoreLinks to solve the initial problem. But I have not taken into account the shape binders which are same as links.
And there are also Draft and PartDesign Clones.

We could add

            return obj->isDerivedFrom<App::Link>() 
                || obj->isDerivedFrom(Base::Type::fromName("PartDesign::SubShapeBinder"));

to fix the case of subShapeBinder, but that cannot solve Draft clone case for instance, as those objects are Part::FeaturePython. Also there might be a lot of case of other objects referencing tree root objects.

@wwmayer is there not a clean way to get the tree-root-level objects? The tree is being build so there must be a way to get that.
See Pendelf video where he shows the problem : https://youtu.be/f-PxEIDXzF4

from freecad.

wwmayer avatar wwmayer commented on June 24, 2024

If you use shape binder to create one of the bodies, the first body will not be available when adding bodies to the assembly

It doesn't work with the sub-shape binder (green icon) but works without problems with the shape binder (blue icon).

is there not a clean way to get the tree-root-level objects?

The method claimChildren() of a view provider shows the referenced objects as child items in the tree view. So, all objects that are not claimed by a view provider must be top-level objects.

But does this really solve the problem? What happens if the two bodies are inside a Part container?

from freecad.

PaddleStroke avatar PaddleStroke commented on June 24, 2024

So to get the tree root object you iterate through all the document objects, build the list of objects that are within at least one of the object VP claimChildren return function, then the root is the rest of the objects right?

If so I will make a 'getTreeRootObject' in Gui.

Yes it solves the problem because 'insert component' is building a tree starting from root objects. So if Part container is a root object, it will be picked up. Then it is iteratively browsed to build the tree so the bodies within are found.

from freecad.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.