View Issue Details

IDProjectCategoryView StatusLast Update
0003491FreeCADBugpublic2018-09-28 13:00
Reporteruuykay Assigned Towmayer  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
PlatformWindowsOSWindows 10OS Version64 bit
Product Version0.17 
Target Version0.18Fixed in Version0.18 
Summary0003491: Import.export not preserving placement of Part Features in STP file export
DescriptionHi FreeCAD team,

I want to report a bug regarding the Import.export function to dump a list of part features to a .stp file format. For example when I run Import.export(array_of_parts, path_to_dump_file) is not correctly positioning the parts. It was working perfectly in 0.16. Please take a look at the images below for 0.17 and then for 0.16 respectively.

I have already posted about this in the forums and a member has recommended that I report this as a bug.

https://forum.freecadweb.org/viewtopic.php?f=10&t=28801&sid=2fc9909c0b67d9d116d2da550d16c17c
Steps To Reproduce
  1. Create a new script in the installation location of FreeCAD e.g. C:/Program Files/FreeCAD 0.17/Mod/test.FCMacro
  2. Paste the following contents into the new script
  3. import FreeCAD
    import Part
    import Import
    
    doc = FreeCAD.newDocument()
    
    
    def genPlacementMatrix():
        yaw = 5000
        pitch = 3000
        roll = 2200
    
        pos = FreeCAD.Vector(0, 0, 0)
        rot = FreeCAD.Rotation(yaw, pitch, roll)
        center = FreeCAD.Vector(0, 0, 0)
        newplace = FreeCAD.Placement(pos, rot, center)
    
        return newplace
    
    # Generate a placement matrix
    newplace = genPlacementMatrix()
    
    stem_radius = 2
    stem_length = 5
    cyl = FreeCAD.ActiveDocument.addObject("Part::Feature", "Cylinder")
    cyl_pos_vec = FreeCAD.Vector(0, 0, 0)
    cyl_dir_vec = FreeCAD.Vector(0, 0, -1)
    cyl_shape = Part.makeCylinder(
        stem_radius, stem_length, cyl_pos_vec, cyl_dir_vec)
    # Set the placement to the cylinder
    cyl_shape.Placement = newplace
    cyl.Shape = cyl_shape
    
    # Create a box, don't worry about placement here
    box_length = 2
    box_width = 2
    box_height = 2
    box = FreeCAD.ActiveDocument.addObject("Part::Feature", "Box")
    box.Shape = Part.makeBox(box_length, box_width, box_height)
    
    # Create a list of the cyl and box part features
    shapeobjs = [cyl, box]
    # Set the dump path
    dump_path_1 = 'D:/GoogleDrive/Product/Connections/FreeCAD/LocalTests/dump1.stp'
    # Do the dumping
    Import.export(shapeobjs, dump_path_1)
    
    #Test with the equivalent gui version of this command
    import ImportGui
    dump_path_2 = 'D:/GoogleDrive/Product/Connections/FreeCAD/LocalTests/dump2.stp'
    ImportGui.export(shapeobjs, dump_path_2)
    
    
  4. Find the variables "dump_path_1" and "dump_path_2" and change the directory to somewhere local to your computer. Keep the file names dump1.stp and dump2.stp
  5. Click the "Execute Macro" button inside of FreeCAD, and find the FCMacro script you created e.g. C:/Program Files/FreeCAD 0.17/Mod/test.FCMacro. Execute the script.
  6. The script will dump 2 files. dump1.stp was created with Import.export. dump2.stp was created with ImportGui.export. Open both files in FreeCAD. You will notice that dump1.stp does not preserve the placement set in by the script. You will notice dump2.stp does preserve the placement. Hence it can be concluded that Import.export has a bug which does not preserve placement.
  7. Please see my forum post here with some images and a conversation between me and another member.
  8. Your text to link here...



Additional InformationOS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.13522 (Git)
Build type: Release
Branch: releases/FreeCAD-0-17
Hash: 3bb5ff4e70c0c526f2d9dd69b1004155b2f527f2
Python version: 2.7.14
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.2.0
Locale: English/Australia (en_AU)
TagsNo tags attached.
FreeCAD Information

Activities

Kunda1

2018-05-26 21:58

administrator   ~0011280

@uuykay please open a forum thread to discuss with the community and link to this ticket (as per the large yellow banner at the top of this page)

uuykay

2018-05-26 22:03

reporter   ~0011283

Hi Kunda1 I already did open a forum thread to discuss it and I have made a comment in the forum thread linking to this ticket. It was all mentioned in my description.

Link here

Kunda1

2018-05-30 23:35

administrator   ~0011314

Bug confirmed by easyw-fc. Marking confirmed and assigning to 0.18 roadmap.

wmayer

2018-09-28 13:00

administrator   ~0011867

https://github.com/FreeCAD/FreeCAD/commit/95efad737b29282b4c85a3927e2e6b3fb15aea6f

Issue History

Date Modified Username Field Change
2018-05-21 23:54 uuykay New Issue
2018-05-26 21:58 Kunda1 Status new => feedback
2018-05-26 21:58 Kunda1 Note Added: 0011280
2018-05-26 22:03 uuykay Note Added: 0011283
2018-05-26 22:03 uuykay Status feedback => new
2018-05-30 23:35 Kunda1 Status new => confirmed
2018-05-30 23:35 Kunda1 Target Version => 0.18
2018-05-30 23:35 Kunda1 Note Added: 0011314
2018-09-28 13:00 wmayer Assigned To => wmayer
2018-09-28 13:00 wmayer Status confirmed => closed
2018-09-28 13:00 wmayer Resolution open => fixed
2018-09-28 13:00 wmayer Fixed in Version => 0.18
2018-09-28 13:00 wmayer Note Added: 0011867