GithubHelp home page GithubHelp logo

Comments (2)

maxwxyz avatar maxwxyz commented on July 3, 2024

@bgbsww FYI

from freecad.

bgbsww avatar bgbsww commented on July 3, 2024

During the process of turning this into a test I didn't see the problem. But when I ran the test I definitely did.

If you turn the sketch visibility on, you can see that it isn't against the second box anymore. I suspect this is because of a failure to correctly apply the placement of that second box. Investigating as to why shows that the change to Box001 changed Face2 into Face9, and that wasn't updated in the Sketch.AttachmentSupport. That's a TNP error for sure. So, why isn't AttachmentSupport getting updated correctly. TBD.

Here's the test:

def testSomething(self):
    doc = App.ActiveDocument
    doc.addObject("Part::Box","Box")
    doc.ActiveObject.Label = "Cube"
    doc.addObject("Part::Box","Box")
    doc.ActiveObject.Label = "Cube"
    from BOPTools import BOPFeatures
    bp = BOPFeatures.BOPFeatures(App.activeDocument())
    bp.make_multi_fuse(["Box", "Box001", ])
    App.activeDocument().addObject('PartDesign::Body','Body')
    doc.Body.Label = 'Body'
    App.activeDocument().Body.BaseFeature = App.activeDocument().Fusion
    doc.Body.newObject('Sketcher::SketchObject','Sketch')
    doc.Sketch.AttachmentSupport = (doc.BaseFeature,['Face2',])
    doc.Sketch.MapMode = 'FlatFace'
    geoList = []
    geoList.append(Part.LineSegment(App.Vector(11.562587, 13.382092, 0.000000),App.Vector(11.562587, 10.644792, 0.000000)))
    geoList.append(Part.LineSegment(App.Vector(11.562587, 10.644792, 0.000000),App.Vector(14.063914, 10.644792, 0.000000)))
    geoList.append(Part.LineSegment(App.Vector(14.063914, 10.644792, 0.000000),App.Vector(14.063914, 13.382092, 0.000000)))
    geoList.append(Part.LineSegment(App.Vector(14.063914, 13.382092, 0.000000),App.Vector(11.562587, 13.382092, 0.000000)))
    doc.Sketch.addGeometry(geoList,False)
    del geoList
    constraintList = []
    constraintList.append(Sketcher.Constraint('Coincident', 0, 2, 1, 1))
    constraintList.append(Sketcher.Constraint('Coincident', 1, 2, 2, 1))
    constraintList.append(Sketcher.Constraint('Coincident', 2, 2, 3, 1))
    constraintList.append(Sketcher.Constraint('Coincident', 3, 2, 0, 1))
    constraintList.append(Sketcher.Constraint('Vertical', 0))
    constraintList.append(Sketcher.Constraint('Vertical', 2))
    constraintList.append(Sketcher.Constraint('Horizontal', 1))
    constraintList.append(Sketcher.Constraint('Horizontal', 3))
    doc.Sketch.addConstraint(constraintList)
    del constraintList
    constraintList = []
    doc.recompute()
    doc.recompute()
    doc.Body.newObject('PartDesign::Pad','Pad')
    doc.Pad.Profile = (doc.Sketch, ['',])
    doc.Pad.Length = 10
    doc.recompute()
    doc.Pad.ReferenceAxis = (doc.Sketch,['N_Axis'])
    doc.Sketch.Visibility = False
    doc.Pad.Length = 10.000000
    doc.Pad.TaperAngle = 0.000000
    doc.Pad.UseCustomVector = 0
    doc.Pad.Direction = (0, -1, 0)
    doc.Pad.ReferenceAxis = (doc.Sketch, ['N_Axis'])
    doc.Pad.AlongSketchNormal = 1
    doc.Pad.Type = 0
    doc.Pad.UpToFace = None
    doc.Pad.Reversed = 0
    doc.Pad.Midplane = 0
    doc.Pad.Offset = 0
    doc.BaseFeature.Visibility = False
    doc.Sketch.Visibility = False
    # Act
    App.getDocument("Unnamed").Box001.Width='3.00 mm'
    App.getDocument("Unnamed").Box001.Height='10.00 mm'
    App.getDocument("Unnamed").Box001.Placement=App.Placement(App.Vector(5.00,5.00,5.00),App.Rotation(App.Vector(0.00,0.00,1.00),0.00))
    doc.recompute()

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.