GithubHelp home page GithubHelp logo

Comments (4)

luzpaz avatar luzpaz commented on May 24, 2024

@easyw would you be able to help with this issue ?

from freecad.

morganrallen avatar morganrallen commented on May 24, 2024

would certainly help where I can. So far I've attempted to find a cause, or workaround from the Python side of things without much success. I'm working on a minimal macro to recreate the issue, this should be helpful debugging the issue further.

from freecad.

morganrallen avatar morganrallen commented on May 24, 2024

ok, here's a minimal macro that I think demonstrates the problem. During the actual FeaturePython and ViewProvider creation parts, nothing is actually added to the PythonFeature.Shape. Despite this, when the Body is added as a group member, the PythonFeature assumes the shape of it's child, effectively duplicating it.

import FreeCAD as App
import Part

def create(obj_name):
    obj = App.ActiveDocument.addObject('Part::FeaturePython', obj_name)

    box(obj)

    ViewProviderBox(obj.ViewObject)

    return obj

class box():
    def __init__(self, obj):
        obj.addExtension('App::GroupExtensionPython')


class ViewProviderBox:

    def __init__(self, obj):
        obj.Proxy = self
        obj.addExtension('Gui::ViewProviderGroupExtensionPython')

    def getIcon(self):
        return """
            /* XPM */
            static const char * ViewProviderBox_xpm[] = {
            "16 16 6 1",
            "    c None",
            ".   c #141010",
            "+   c #615BD2",
            "@   c #C39D55",
            "#   c #000000",
            "$   c #57C355",
            "        ........",
            "   ......++..+..",
            "   .@@@@.++..++.",
            "   .@@@@.++..++.",
            "   .@@  .++++++.",
            "  ..@@  .++..++.",
            "###@@@@ .++..++.",
            "##$.@@$#.++++++.",
            "#$#$.$$$........",
            "#$$#######      ",
            "#$$#$$$$$#      ",
            "#$$#$$$$$#      ",
            "#$$#$$$$$#      ",
            " #$#$$$$$#      ",
            "  ##$$$$$#      ",
            "   #######      "};
            """

    def canDropObject(self, obj):
        return True

o1 = create('test')

body = App.ActiveDocument.addObject('PartDesign::Body','Body')
box = App.ActiveDocument.addObject('PartDesign::AdditiveBox','Box')

box.Length = 10
box.Width = 10
box.Height = 10

body.addObject(box)
o1.addObject(body)
o1.Placement.Base.x = 12

App.ActiveDocument.recompute()

from freecad.

morganrallen avatar morganrallen commented on May 24, 2024

Couple other things I've noticed, that seem like problematic behavior...

If the Placement on the Feature is changed, it's Shape is moved, but the Body in the Group does not. My feeling for how this should work, is if a Group is moved, all of it's Children should also be moved accordingly. Also in this case the Placement of neither the Feature nor its Shape are updated, which I >guess< hints at a rendering error?

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.