DXF - 3D-Solid import

Info about new community or project announcements, implemented features, classes, modules or APIs. Might get technical!
PLEASE DO NOT POST HELP REQUESTS OR OTHER DISCUSSIONS HERE!
User avatar
apeltauer
Posts: 291
Joined: Fri Aug 11, 2017 2:19 pm

Re: DXF - 3D-Solid import

Postby apeltauer » Tue May 19, 2020 5:44 pm

I had the same problem:
Some errors were found that prevent to install this workbench: Missing python module: xlutils, Missing python module: xlrd, Missing python module: xlwt, Missing python module: olefile , . Please install the missing components first.
What i did is to get the packages via pip.
I went to the bin folder where python.exe is located (same folder where FreeCAD.exe is located), then i used the following:

Code: Select all

python.exe -m pip install xlutils
Doing this for the other packages as well. Make sure you have write permission!
jmplonka
Posts: 98
Joined: Tue Dec 20, 2016 7:47 am
Location: Vaihingen (Enz), Germany

Re: DXF - 3D-Solid import

Postby jmplonka » Wed May 20, 2020 7:24 am

Another attempt:
  1. run FreeCAD with administration privileges.
  2. open FreeCAD's python console and enter:

    Code: Select all

    import subprocess
    subprocess.call("python.exe -m pip install olefile")
    subprocess.call("python.exe -m pip install xlwt")
    subprocess.call("python.exe -m pip install xlrd")
    subprocess.call("python.exe -m pip install xlutils")
    
  3. restart FreeCAD
User avatar
yorik
Site Admin
Posts: 11845
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: DXF - 3D-Solid import

Postby yorik » Wed May 20, 2020 8:04 am

This is interesting... Would anyone have a sample DXF file with an ACIS solid inside? I'd like to test how to identify it and how our DXF importer could use the InventorPlugin if available...
jmplonka
Posts: 98
Joined: Tue Dec 20, 2016 7:47 am
Location: Vaihingen (Enz), Germany

Re: DXF - 3D-Solid import

Postby jmplonka » Wed May 20, 2020 8:10 am

Roy_043 attached one in his bug-reports: Reading DXF file:
  1. importerDXF.read(filename) # file of the DXF that contains 3D-Solids
  2. importerDXF.create3dModel(group, doc) # group the group object (maybe None for root element) in the doc (e.g. FreeCAD.getDocument(docname))
kisolre
Posts: 2102
Joined: Wed Nov 21, 2018 1:13 pm

Re: DXF - 3D-Solid import

Postby kisolre » Wed May 20, 2020 8:33 am

jmplonka wrote:
Wed May 20, 2020 7:24 am
run FreeCAD with administration privileges.
Here it worked even without this.
In one of the files I get the following error:

Code: Select all

Importing: C:/Users/Wivern/AppData/Roaming/FreeCAD/Mod/InventorLoader/Demo-Status/Demo-Status-0.4.2.ipt
    created with Autodesk Inventor 2015 SP2 (Build 190223200, 223)
 7: '2ndf4cbxltchc12ouyxn3mibnb' ('PmBrowserSegment')
    NO READER DEFINED FOR PmBrowserSegment 'PmBrowserSegment'
 8: '5d5xv3ga6qwy3f6emf2jk5fhbj' ('PmAppSegment')
    NO READER DEFINED FOR PmAppSegment 'PmAppSegment'
 9: 'bs6eamaw2oin4ji1vd23znm1bp' ('PmBRepSegment')
    NO READER DEFINED FOR PmBRepSegment 'PmBRepSegment'
10: 'e5egmocggicavdjamfludnuwnf' ('PmResultSegment')
    NO READER DEFINED FOR PmResultSegment 'PmResultSegment'
Traceback (most recent call last):
  File "C:\Users\Wivern\AppData\Roaming\FreeCAD\Mod\InventorLoader\importerSegment.py", line 578, in HandleBlock
    i = readType(node)
  File "C:\Users\Wivern\AppData\Roaming\FreeCAD\Mod\InventorLoader\importerSegment.py", line 649, in Read_F645595C
    txt, ignore = getText8(node.data, i, 15) # 'ACIS BinaryFile' or from 20214 on 'ASM BinaryFile4'
  File "C:\Users\Wivern\AppData\Roaming\FreeCAD\Mod\InventorLoader\importerUtils.py", line 711, in getText8
    txt = data[i: end].decode(ENCODING_FS)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 5: invalid start byte

11: 'itgitbhiz6t5uems4o2qoweina' ('NBNotebookSegment')
    NO READER DEFINED FOR NBNotebookSegment 'NBNotebookSegment'
12: 'snk62ndlbh5pahct4qy66rg1jd' ('PmGraphicsSegment')
    NO READER DEFINED FOR PmGraphicsSegment 'PmGraphicsSegment'
13: 'sq2ififzcxb4fg1qes6xlmynfm' ('DesignViewSegment')
    NO READER DEFINED FOR DesignViewSegment 'DesignViewSegment'
14: 'trf4ijcnldyb6jcuvg6lae32jm' ('PmDCSegment')
    NO READER DEFINED FOR PmDCSegment 'PmDCSegment'
Reading: C:\Users\Wivern\AppData\Roaming\FreeCAD\Mod\InventorLoader\Demo-Status\Demo-Status-0.4.2.ipt
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\Wivern\AppData\Roaming\FreeCAD\Mod\InventorLoader\importerIL.py", line 108, in insert
    open(filename, skip, only, root)
  File "C:\Users\Wivern\AppData\Roaming\FreeCAD\Mod\InventorLoader\importerIL.py", line 121, in open
    reader = read(doc, filename, True)
  File "C:\Users\Wivern\AppData\Roaming\FreeCAD\Mod\InventorLoader\importerIL.py", line 40, in read
    if (Import_IPT.read(doc, filename, readProperties)):
  File "C:\Users\Wivern\AppData\Roaming\FreeCAD\Mod\InventorLoader\Import_IPT.py", line 138, in read
    ole = setInventorFile(filename)
  File "C:\Users\Wivern\AppData\Roaming\FreeCAD\Mod\InventorLoader\importerUtils.py", line 938, in setInventorFile
    setDumpFolder(_inventor_file)
  File "C:\Users\Wivern\AppData\Roaming\FreeCAD\Mod\InventorLoader\importerUtils.py", line 894, in setDumpFolder
    cleanDumpFolder()
  File "C:\Users\Wivern\AppData\Roaming\FreeCAD\Mod\InventorLoader\importerUtils.py", line 884, in cleanDumpFolder
    os.unlink(p)
<class 'PermissionError'>: [WinError 32] Процесът не може да направи обръщение към файла, защото той се използва от друг процес: 'C:\\Users\\Wivern\\AppData\\Roaming\\FreeCAD\\Mod\\InventorLoader\\Demo-Status\\Demo-Status-0.4.2_ipt\\PmDCSegment.log'
With Demo-Status-0.6.ipt I get this:

Code: Select all

Reading: C:\Users\Wivern\AppData\Roaming\FreeCAD\Mod\InventorLoader\Demo-Status\Demo-Status-0.6.ipt
    created with Autodesk Inventor 2015 SP2 (Build 190223200, 223)
	'Inventor Document Summary Information': (LC = 407)
	'Design Tracking Properties': (LC = 407)
	'_Private Model Information': (LC = 407)
	'Design Tracking Control': (LC = 407)
	'Inventor User Defined Properties': (LC = 407)
	'Inventor Summary Information': (LC = 407)
 1: '3gm2w4dvgmdkaow1ef6m6qj2bj' ('PmBRepSegment')
 2: 'bckpdcgie6iffzsnnye1ak2gjj' ('PmGraphicsSegment')
 3: 'emt5dzgmqvhsuxayvjdvwqxtbe' ('DesignViewSegment')
 4: 'iatxnwa14bribrqgeakdortknk' ('NBNotebookSegment')
 5: 'joanh4duwkq1ztk642dvql3xfd' ('PmBrowserSegment')
 6: 'ksr4rkghtutv2hjeurmgvaqjbb' ('PmResultSegment')
 7: 'leuwg1ezsox4dkk1fsofta24fp' ('PmDCSegment')
 8: 'px4nd4fy54o6jmhx352t5hpwnm' ('PmAppSegment')
Dumped data to folder: 'C:\Users\Wivern\AppData\Roaming\FreeCAD\Mod\InventorLoader\Demo-Status\Demo-Status-0.6_ipt'
    adding parameters table...
        A2='d18'; B2='=0.25'; C2='0.25mm'; D2='NOMINAL'
        A3='d19'; B3='=0.10000000000000002'; C3='0.1mm'; D3='NOMINAL'
        A4='d20'; B4='=0.25'; C4='0.25mm'; D4='NOMINAL'
        A5='d21'; B5='=180.0'; C5='180°'; D5='NOMINAL'
        A6='d22'; B6='=10.0'; C6='10mm'; D6='NOMINAL'
        A7='d23'; B7='=3.0000000000000004'; C7='3mm'; D7='NOMINAL'
        A8='d24'; B8='=4.9'; C8='4.9'; D8='NOMINAL'
        A9='d25'; B9='=2.5'; C9='2.5°'; D9='NOMINAL'
        A10='d26'; B10='=90.0'; C10='90°'; D10='NOMINAL'
        A11='d27'; B11='=90.0'; C11='90°'; D11='NOMINAL'
        A12='d28'; B12='=0.0'; C12='0°'; D12='NOMINAL'
        A13='d29'; B13='=0.0'; C13='0°'; D13='NOMINAL'
        A14='d33'; B14='=0.25'; C14='0.25mm'; D14='NOMINAL'
        A15='d34'; B15='=0.10000000000000002'; C15='0.1mm'; D15='NOMINAL'
        A16='d35'; B16='=0.25'; C16='0.25mm'; D16='NOMINAL'
        A17='d36'; B17='=10.0'; C17='10mm'; D17='NOMINAL'
        A18='d37'; B18='=3.2000000000000006'; C18='3.2mm'; D18='NOMINAL'
        A19='d38'; B19='=4.8'; C19='4.8'; D19='NOMINAL'
        A20='d39'; B20='=2.5'; C20='2.5°'; D20='NOMINAL'
        A21='d40'; B21='=90.0'; C21='90°'; D21='NOMINAL'
        A22='d41'; B22='=90.0'; C22='90°'; D22='NOMINAL'
        A23='d42'; B23='=0.0'; C23='0°'; D23='NOMINAL'
        A24='d43'; B24='=0.0'; C24='0°'; D24='NOMINAL'
        A25='d44'; B25='=180.0'; C25='180°'; D25='NOMINAL'
        A26='d48'; B26='=0.5'; C26='0.5mm'; D26='NOMINAL'
        A27='d50'; B27='=4.0'; C27='4mm'; D27='NOMINAL'
        A28='d51'; B28='=0.10000000000000002'; C28='0.1mm'; D28='NOMINAL'
        A29='d52'; B29='=0.10000000000000002'; C29='0.1mm'; D29='NOMINAL'
        A30='d53'; B30='=180.0'; C30='180°'; D30='NOMINAL'
        A31='d54'; B31='=10.0'; C31='10mm'; D31='NOMINAL'
        A32='d55'; B32='=2.5'; C32='2.5mm'; D32='NOMINAL'
        A33='d56'; B33='=5.42'; C33='5.42'; D33='NOMINAL'
        A34='d57'; B34='=14.999999999999998'; C34='15°'; D34='NOMINAL'
        A35='d58'; B35='=90.0'; C35='90°'; D35='NOMINAL'
        A36='d59'; B36='=90.0'; C36='90°'; D36='NOMINAL'
        A37='d60'; B37='=0.0'; C37='0°'; D37='NOMINAL'
        A38='d61'; B38='=0.0'; C38='0°'; D38='NOMINAL'
        A39='d62'; B39='=10.0'; C39='10mm'; D39='NOMINAL'
        A40='d63'; B40='=1.0'; C40='1mm'; D40='NOMINAL'
        A41='d64'; B41='=3.0'; C41='3'; D41='NOMINAL'
        A42='d65'; B42='=0.0'; C42='0°'; D42='NOMINAL'
        A43='d66'; B43='=90.0'; C43='90°'; D43='NOMINAL'
        A44='d67'; B44='=90.0'; C44='90°'; D44='NOMINAL'
        A45='d68'; B45='=0.0'; C45='0°'; D45='NOMINAL'
        A46='d69'; B46='=0.0'; C46='0°'; D46='NOMINAL'
        A47='d70'; B47='=0.25'; C47='0.25mm'; D47='NOMINAL'
        A48='d71'; B48='=0.10000000000000002'; C48='0.1mm'; D48='NOMINAL'
        A49='d72'; B49='=0.25'; C49='0.25mm'; D49='NOMINAL'
        A50='d73'; B50='=10.0'; C50='10mm'; D50='NOMINAL'
        A51='d74'; B51='=3.4250000000000003'; C51='3.425mm'; D51='NOMINAL'
        A52='d75'; B52='=5.25'; C52='5.25'; D52='NOMINAL'
        A53='d76'; B53='=5.0'; C53='5°'; D53='NOMINAL'
        A54='d77'; B54='=90.0'; C54='90°'; D54='NOMINAL'
        A55='d78'; B55='=90.0'; C55='90°'; D55='NOMINAL'
        A56='d79'; B56='=0.0'; C56='0°'; D56='NOMINAL'
        A57='d80'; B57='=0.0'; C57='0°'; D57='NOMINAL'
        A58='d81'; B58='=180.0'; C58='180°'; D58='NOMINAL'
        A59='d82'; B59='=0.25'; C59='0.25mm'; D59='NOMINAL'
        A60='d83'; B60='=0.10000000000000002'; C60='0.1mm'; D60='NOMINAL'
        A61='d84'; B61='=0.25'; C61='0.25mm'; D61='NOMINAL'
        A62='d85'; B62='=180.0'; C62='180°'; D62='NOMINAL'
        A63='d86'; B63='=10.0'; C63='10mm'; D63='NOMINAL'
        A64='d87'; B64='=3.3'; C64='3.3mm'; D64='NOMINAL'
        A65='d88'; B65='=5.25'; C65='5.25'; D65='NOMINAL'
        A66='d89'; B66='=2.5'; C66='2.5°'; D66='NOMINAL'
        A67='d90'; B67='=90.0'; C67='90°'; D67='NOMINAL'
        A68='d91'; B68='=90.0'; C68='90°'; D68='NOMINAL'
        A69='d92'; B69='=0.0'; C69='0°'; D69='NOMINAL'
        A70='d93'; B70='=0.0'; C70='0°'; D70='NOMINAL'
    adding 3D-Sketch '3D-Skizze1' ...
        ... added line (-0.1,0,0)-(-0.2,0.1,-0.3) False
        ... added line (0.1,0,0)-(0.2,-0.1,-0.3) False
        ... added line (-0.2,0,0.3)-(-0.3,-0.2,0.1) False
        ... added line (0.2,0,0.3)-(0.3,0.1,0.1) False
    adding 2D-Sketch 'Hand_Arm_R' ...
        ... added Arc-Circle M=(-1.00001,2.82686) R=0.25, from 3.141592653589793 to 0.0 ...
        ... added line (-0.750006,2.82686)-(-1.25001,2.82686) False = 1
        ... added Circle M=(-0.750006,2.66103) R=0.05...
        ... added line (-1.00001,2.82686)-(0,0) False = 3
Sketcher::setUpSketch()-T:0
Sketcher::Solve()-DogLeg-T:0
        ... added perpendicular constraint between lines 1 and 0
Sketcher::setUpSketch()-T:0
Sketcher::Solve()-DogLeg-T:0
        ... added horizontal constraint to line 1
Sketcher::setUpSketch()-T:0
Sketcher::Solve()-DogLeg-T:0
        ... added tangential constraint between Circle 0 and Circle 2
Sketcher::setUpSketch()-T:0
Sketcher::Solve()-DogLeg-T:0
Sketcher::setUpSketch()-T:0.001
Sketcher::Solve()-DogLeg-T:0
        ... added radius 'd18' = 0.25mm
Sketcher::setUpSketch()-T:0
Sketcher::Solve()-DogLeg-T:0
        ... added diameter 'd19' = 0.1mm (r = 0.05000000000000001 mm)
    adding FxRevolve 'Hand_R' ...
Sketcher::setUpSketch()-T:0
Sketcher::Solve()-DogLeg-T:0
Sketcher::setUpSketch()-T:0
Sketcher::Solve()-DogLeg-T:0
    ... based on 'Hand_Arm_R' (full) ...
    adding FxCoil 'Arm_R' ...
        ... Feature 'Coil' not supported yet - trying SAT instead.
    adding 2D-Sketch 'Hand_Arm_L' ...
        ... added Arc-Circle M=(2.4495,-9.1995e-06) R=0.25, from 1.5707963267948966 to 4.7123889803846915 ...
        ... added line (2.4495,-0.250009)-(2.4495,0.249991) False = 1
        ... added line (2.4495,-9.1995e-06)-(-0.0126861,-9.1995e-06) False = 2
        ... added Circle M=(2.28367,-0.250009) R=0.05...
Sketcher::setUpSketch()-T:0
Sketcher::Solve()-DogLeg-T:0
        ... added vertical constraint to line 0
Sketcher::setUpSketch()-T:0
Sketcher::Solve()-DogLeg-T:0
        ... added perpendicular constraint between lines 1 and 2
Sketcher::setUpSketch()-T:0
Sketcher::Solve()-DogLeg-T:0
        ... added tangential constraint between Circle 0 and Circle 3
Sketcher::setUpSketch()-T:0.001
Sketcher::Solve()-DogLeg-T:0
Sketcher::setUpSketch()-T:0
Sketcher::Solve()-DogLeg-T:0
        ... added diameter 'd34' = 0.1mm (r = 0.05000000000000001 mm)
    adding FxCoil 'Arm_L' ...
        ... Feature 'Coil' not supported yet - trying SAT instead.
Sketcher::setUpSketch()-T:0
Sketcher::Solve()-DogLeg-T:0
    adding FxRevolve 'Hand_L' ...
Sketcher::setUpSketch()-T:0
Sketcher::Solve()-DogLeg-T:0
    ... based on 'Hand_Arm_L' (full) ...
    adding 2D-Sketch 'Head_Torso' ...
        ... added Arc-Circle M=(2.17465e-05,4) R=0.5, from 0.0 to 3.141592653589793 ...
        ... added line (2.17465e-05,4)-(0.500022,4) True = 1
        ... added line (0.500022,4)-(-0.499978,4) False = 2
        ... added Circle M=(1.00579,0) R=0.05...
        ... added Circle M=(1,1) R=0.05...
Sketcher::setUpSketch()-T:0.001
Sketcher::Solve()-DogLeg-T:0
        ... added perpendicular constraint between lines 2 and 0
Sketcher::setUpSketch()-T:0
Sketcher::Solve()-DogLeg-T:0
Sketcher::setUpSketch()-T:0
Sketcher::Solve()-DogLeg-T:0
        ... added diameter 'd52' = 0.1mm (r = 0.04999999999999998 mm)
        ... added coincident constraint between Circle 0/1 and Line 1/2
Sketcher::setUpSketch()-T:0
Sketcher::Solve()-DogLeg-T:0
        ... added coincident constraint between Circle 0/1 and Line 2/1
Sketcher::setUpSketch()-T:0
Sketcher::Solve()-DogLeg-T:0
    adding FxRevolve 'Head' ...
Sketcher::setUpSketch()-T:0
Sketcher::Solve()-DogLeg-T:0
Sketcher::setUpSketch()-T:0.001
Sketcher::Solve()-DogLeg-T:0
    ... based on 'Head_Torso' (full) ...
    adding FxCoil 'Torso_U' ...
        ... Feature 'Coil' not supported yet - trying SAT instead.
    adding FxCoil 'Torso_B' ...
        ... Feature 'Coil' not supported yet - trying SAT instead.
    adding 2D-Sketch 'Foot_Leg_R' ...
        ... added Arc-Circle M=(-1.00002,3.16227) R=0.25, from 3.141592653589793 to 0.0 ...
        ... added line (-1.25002,3.16227)-(-0.750015,3.16227) False = 1
        ... added Circle M=(-1.25002,2.99644) R=0.05...
        ... added 2D-Ellipse  center=(-0.00578844,0) a=(0.0442116,0) b=(-0.00578844,-0.0474342) ...
        ... added line (-1.00002,3.16227)-(-0.00578844,0) False = 4
Sketcher::setUpSketch()-T:0
Sketcher::Solve()-DogLeg-T:0
    adding FxCoil 'Leg_R' ...
        ... Feature 'Coil' not supported yet - trying SAT instead.
    adding FxRevolve 'Foot_R' ...
Sketcher::setUpSketch()-T:0
Sketcher::Solve()-DogLeg-T:0
    ... based on 'Foot_Leg_R' (full) ...
    adding 2D-Sketch 'Foot_Leg_L' ...
        ... added Arc-Circle M=(3.31667,-5.55112e-16) R=0.25, from 1.5707963267948966 to 4.712388980384688 ...
        ... added line (3.31667,-0.25)-(3.31667,0.25) False = 1
        ... added Circle M=(3.15084,0.25) R=0.05...
        ... added line (0,0)-(3.31667,-5.55112e-16) False = 3
Sketcher::setUpSketch()-T:0
Sketcher::Solve()-DogLeg-T:0
    adding FxRevolve 'Foot_L' ...
Sketcher::setUpSketch()-T:0.001
Sketcher::Solve()-DogLeg-T:0
    ... based on 'Foot_Leg_L' (full) ...
    adding FxCoil 'Leg_L' ...
        ... Feature 'Coil' not supported yet - trying SAT instead.
DONE!
and some weird twists:
.
Twists.JPG
Twists.JPG (72.59 KiB) Viewed 235 times
.
OS: Windows 8.1 (6.3)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.21120 (Git)
Build type: Release
Branch: master
Hash: 517ae79341b2c74af6574f7ae9f1de4e3e084c67
Python version: 3.6.6
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: Bulgarian/Bulgaria (bg_BG)
User avatar
sgrogan
Posts: 5802
Joined: Wed Oct 22, 2014 5:02 pm

Re: DXF - 3D-Solid import

Postby sgrogan » Wed May 20, 2020 8:17 pm

apeltauer wrote:
Tue May 19, 2020 5:44 pm
What i did is to get the packages via pip.
jmplonka wrote:
Wed May 20, 2020 7:24 am
open FreeCAD's python console and enter
@apeltauer, what do you think about just adding this to the Libpack? I can do this for a 12.1.6 Libpack, but I don't want to get our versions crossed again. I can do the same for the Conda builds so these modules are available for linux and osx by default as well.
johnwang
Posts: 275
Joined: Sun Jan 27, 2019 12:41 am

Re: DXF - 3D-Solid import

Postby johnwang » Wed May 20, 2020 10:23 pm

Nice job.
User avatar
apeltauer
Posts: 291
Joined: Fri Aug 11, 2017 2:19 pm

Re: DXF - 3D-Solid import

Postby apeltauer » Thu May 21, 2020 7:23 am

sgrogan wrote:
Wed May 20, 2020 8:17 pm
apeltauer wrote:
Tue May 19, 2020 5:44 pm
What i did is to get the packages via pip.
jmplonka wrote:
Wed May 20, 2020 7:24 am
open FreeCAD's python console and enter
@apeltauer, what do you think about just adding this to the Libpack? I can do this for a 12.1.6 Libpack, but I don't want to get our versions crossed again. I can do the same for the Conda builds so these modules are available for linux and osx by default as well.
Creating a new Libpack is a good idea.