FreeCAD .FCStd importer for Blender 2.80

Need help, or want to share a macro? Post here!
User avatar
yorik
Site Admin
Posts: 11645
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: FreeCAD .FCStd importer for Blender 2.80

Post by yorik » Wed Oct 09, 2019 1:32 pm

I think both approaches are valid... It depends much more, actually, if you are more a "FreeCAD person" (your "master" file will be the freecad file, and you will prefer an fcstd importer in blender, to reimport/update the full file), or a "Blender person" (your master file will be the blender file, you will prefer to import pieces from freecad, hence Bayesian's idea makes full sense)

That's the great aspect of open-source projects, both can coexist.
Bayesian
Posts: 60
Joined: Thu Aug 08, 2019 1:49 pm

Re: FreeCAD .FCStd importer for Blender 2.80

Post by Bayesian » Wed Oct 09, 2019 2:46 pm

From my perspective Blender and FreeCAD don't overlap much, so I expect a clear division of tasks between FC and Blender depending on the usecase.

I also suspect that the flow of data is mostly from FreeCAD to Blender, rather than the other way, because Blender is very good at rendering and animating and FC doesn't provide a whole lot of hooks for such information.

Linked Libraries are also a good idea, sometimes. But I guess the primary challenge for updating is to keep the references between Blender Meshes and FreeCAD objects intact.
User avatar
pl7i92LCNC
Posts: 209
Joined: Tue Mar 12, 2019 3:03 pm
Location: RLP DE

Re: FreeCAD .FCStd importer for Blender 2.80

Post by pl7i92LCNC » Wed Oct 09, 2019 3:14 pm

for me it depends on parts to handle
like curve design Blender handels things for printing easier
but on cunstruction real Mechanic parts or Arch most go over to FC
print_rat.jpg
print_rat.jpg (142.22 KiB) Viewed 696 times
User avatar
yorik
Site Admin
Posts: 11645
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: FreeCAD .FCStd importer for Blender 2.80

Post by yorik » Wed Oct 09, 2019 6:56 pm

Regarding your issues with bodies and not having the same number of objects in a same file, internally and externally: That's pretty worrying! Can you share a test file?
User avatar
s-light
Posts: 51
Joined: Thu Feb 12, 2015 11:39 am
Location: Germany, Hofheim am Taunus
Contact:

Re: FreeCAD .FCStd importer for Blender 2.80

Post by s-light » Fri Oct 25, 2019 6:28 pm

sorry for the late reply - somehow the forum did not want to send me notifications :-(
yorik wrote:
Wed Oct 09, 2019 6:56 pm
Regarding your issues with bodies and not having the same number of objects in a same file, internally and externally: That's pretty worrying! Can you share a test file?
i have created a very simple test file:
Image
https://github.com/s-light/io_import_fc ... Test.FCStd
it contains this structure:
Image


if i copy&paste the content from list_objects_copypaste.py into the FreeCAD python console i get this:

Code: Select all

>>> # ******************************************
>>> #
>>> #            Main experimetns
>>> #
>>> # ******************************************
>>> 
>>> doc = FreeCAD.ActiveDocument
>>> docname = doc.Name
>>> 
>>> # ******************************************
>>> objects = doc.Objects
>>> print("doc.Objects", len(objects))
doc.Objects 19
>>> print_objects(objects)
  Label           Name                      TypeId                   
* BodyTest_Part             Part            App::Part                
* Origin                    Origin          App::Origin              
* X_Axis                    X_Axis          App::Line                
* Y_Axis                    Y_Axis          App::Line                
* Z_Axis                    Z_Axis          App::Line                
* XY_Plane                  XY_Plane        App::Plane               
* XZ_Plane                  XZ_Plane        App::Plane               
* YZ_Plane                  YZ_Plane        App::Plane               
* Body_Hex                  Body            PartDesign::Body         
* Origin001                 Origin001       App::Origin              
* X_Axis001                 X_Axis001       App::Line                
* Y_Axis001                 Y_Axis001       App::Line                
* Z_Axis001                 Z_Axis001       App::Line                
* XY_Plane001               XY_Plane001     App::Plane               
* XZ_Plane001               XZ_Plane001     App::Plane               
* YZ_Plane001               YZ_Plane001     App::Plane               
* Sketch                    Sketch          Sketcher::SketchObject   
* Pad                       Pad             PartDesign::Pad          
* Sphere_Sun                Sphere          Part::Sphere             
>>> 
>>> # ******************************************
>>> 
>>> print_obj_with_label(doc, "BodyTest_Part")
BodyTest_Part             Part            App::Part                
>>> print_obj_with_label(doc, "Body_Hex")
Body_Hex                  Body            PartDesign::Body         
>>> print_obj_with_label(doc, "Sphere_Sun")
Sphere_Sun                Sphere          Part::Sphere             
>>> 
>>> # ******************************************
>>> print("tests done :-)")
tests done :-)
>>> 
if i run the script list_objects.py in the same directory as the file i get this:

Code: Select all

Latitude-E6510:~/mydata/github/blender/io_import_fcstd/dev/freecad_test_body_objects (master)$ ./list_objects.py 
Configured FreeCAD path: /usr/lib/freecad-daily-python3/lib
Sheet Metal workbench loaded
FreeCAD version: ['0', '19', '', 'https://code.launchpad.net/~vcs-imports/freecad/trunk', '2019/10/25 00:22:09']
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
doc.Objects 17
  Label           Name                      TypeId                   
* BodyTest_Part             Part            App::Part                
* Origin                    Origin          App::Origin              
* X_Axis                    X_Axis          App::Line                
* Y_Axis                    Y_Axis          App::Line                
* Z_Axis                    Z_Axis          App::Line                
* XY_Plane                  XY_Plane        App::Plane               
* XZ_Plane                  XZ_Plane        App::Plane               
* YZ_Plane                  YZ_Plane        App::Plane               
* Origin001                 Origin001       App::Origin              
* X_Axis001                 X_Axis001       App::Line                
* Y_Axis001                 Y_Axis001       App::Line                
* Z_Axis001                 Z_Axis001       App::Line                
* XY_Plane001               XY_Plane001     App::Plane               
* XZ_Plane001               XZ_Plane001     App::Plane               
* YZ_Plane001               YZ_Plane001     App::Plane               
* Sketch                    Sketch          Sketcher::SketchObject   
* Sphere_Sun                Sphere          Part::Sphere             
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BodyTest_Part             Part            App::Part                
object with label 'Body_Hex' not found.
Sphere_Sun                Sphere          Part::Sphere             
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tests done :-)

so in the external listing i get 2 objects less - and this are:
* Body_Hex Body PartDesign::Body
* Pad Pad PartDesign::Pad


---

if a second test file with a little bit more objects is needed:
https://github.com/s-light/io_import_fc ... orld.FCStd
and there is also a complex test file with linking:
https://github.com/s-light/io_import_fc ... port.FCStd

hope this helps in finding the source for this...

sunny greetings
stefan
alxscott
Posts: 4
Joined: Mon Oct 28, 2019 5:38 pm

Re: FreeCAD .FCStd importer for Blender 2.80

Post by alxscott » Mon Oct 28, 2019 5:47 pm

Hi,

I haven't posted this on GitHub -> Issues as its almost certainly an issue with me / my install... However whenever I install this plugin, or the original, I CANNOT get the import to complete.

I have installed via .zip file, enable the plugin and set the FreeCAD.so path (/Applications/FreeCAD.app/Contents/Resources/lib/FreeCAD.so), saved preferences, reloaded Blender, then File, Import, .FCStd. I then get the error ( Screenshot below).

If I run "import FreeCAD" in console I get no error.

OS: macOS Catalina, FreeCAD version 0.19 - 18524, Blender Version 2.80 (2.80 2019-07-29)
Screenshot 2019-10-28 at 17.35.44.png
Screenshot 2019-10-28 at 17.35.44.png (113.28 KiB) Viewed 520 times
User avatar
s-light
Posts: 51
Joined: Thu Feb 12, 2015 11:39 am
Location: Germany, Hofheim am Taunus
Contact:

Re: FreeCAD .FCStd importer for Blender 2.80

Post by s-light » Tue Oct 29, 2019 5:51 pm

Hey alxscott,

thanks for trying :-)

i think it was a classical bug i introduced...
i have uploaded - hopefully - a fix.

please have a try :-)

sunny greetings
stefan
alxscott
Posts: 4
Joined: Mon Oct 28, 2019 5:38 pm

Re: FreeCAD .FCStd importer for Blender 2.80

Post by alxscott » Wed Oct 30, 2019 7:49 am

s-light wrote:
Tue Oct 29, 2019 5:51 pm
Hey alxscott,

thanks for trying :-)

i think it was a classical bug i introduced...
i have uploaded - hopefully - a fix.

please have a try :-)

sunny greetings
stefan
Ah thank you Stefan! I’ll hopefully get a minute to try that tonight!

Thanks again.

Alex
alxscott
Posts: 4
Joined: Mon Oct 28, 2019 5:38 pm

Re: FreeCAD .FCStd importer for Blender 2.80

Post by alxscott » Wed Oct 30, 2019 6:13 pm

s-light wrote:
Tue Oct 29, 2019 5:51 pm
Hey alxscott,

thanks for trying :-)

i think it was a classical bug i introduced...
i have uploaded - hopefully - a fix.

please have a try :-)

sunny greetings
stefan
Hi Stefan,

Unfortunately I now have this error... But its a different error!
Screenshot 2019-10-30 at 18.06.24.png
Screenshot 2019-10-30 at 18.06.24.png (184.63 KiB) Viewed 446 times
User avatar
s-light
Posts: 51
Joined: Thu Feb 12, 2015 11:39 am
Location: Germany, Hofheim am Taunus
Contact:

Re: FreeCAD .FCStd importer for Blender 2.80

Post by s-light » Wed Oct 30, 2019 9:47 pm

alxscott wrote:
Wed Oct 30, 2019 6:13 pm
But its a different error!
:-) this one i can fix easily ;-)
Please - after Downloading rename the zip from "io_import_fcstd-master.zip" to "io_import_fcstd.zip"
otherwise blender things the addon is called "io_import_fcstd-master"...
and this breaks the assumptions from the script...
i will add this as a note to the readme -
and later will try to handle this in the script itself..

by the way - be warned ;-) - iam currently making realtiv big changes -
and currently i do this in the master branch..
once i get this to work mostly i will switch my development to a user-friendlier 'release' based thing..

if you are familiar with git i highly encourage to clone the repro..
this way it could be easier to update.

sunny greetings
stefan
Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests