FreeCAD .FCStd importer for Blender 2.80

Need help, or want to share a macro? Post here!
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 » Thu Oct 31, 2019 1:47 pm

s-light wrote:
Wed Oct 30, 2019 9:47 pm
this one i can fix easily
or at least i thought so.. :lol:
you would need to rename the folder that is stored inside the zip...

now i have fixed the addon itself -
so it should work now!
(was issues/9)
and updated the readme.

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 » Thu Oct 31, 2019 7:56 pm

s-light wrote:
Thu Oct 31, 2019 1:47 pm
s-light wrote:
Wed Oct 30, 2019 9:47 pm
this one i can fix easily
or at least i thought so.. :lol:
you would need to rename the folder that is stored inside the zip...

now i have fixed the addon itself -
so it should work now!
(was issues/9)
and updated the readme.

sunny greetings
stefan
lol!! Worked perfectly, thank you very much! :)

Alex
vocx
Posts: 2829
Joined: Thu Oct 18, 2018 9:18 pm

Re: FreeCAD .FCStd importer for Blender 2.80

Post by vocx » Sat Dec 21, 2019 12:35 am

s-light wrote:
Fri Oct 25, 2019 6:28 pm
...
so in the external listing i get 2 objects less - and this are:
* Body_Hex Body PartDesign::Body
* Pad Pad PartDesign::Pad
...
Do you still have this problem? I think we can call realthunder to take a look at why the objects aren't created.

What exactly is the "external listing"? Is it using FreeCAD as a library?
To support the documentation effort, and code development, your donation is appreciated: paypal.
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 Jan 15, 2020 5:09 pm

vocx wrote:
Sat Dec 21, 2019 12:35 am
s-light wrote:
Fri Oct 25, 2019 6:28 pm
...
so in the external listing i get 2 objects less - and this are:
* Body_Hex Body PartDesign::Body
* Pad Pad PartDesign::Pad
...
Do you still have this problem? I think we can call realthunder to take a look at why the objects aren't created.

What exactly is the "external listing"? Is it using FreeCAD as a library?
yes - i import with
(source)

Code: Select all

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""
List Objects.
Stand-alone
"""

import sys
import os


path_to_freecad = "/usr/lib/freecad-daily-python3/lib/FreeCAD.so"


def append_freecad_path():
    """Append the FreeCAD path."""
    global path_to_freecad
    if os.path.exists(path_to_freecad):
        if os.path.isfile(path_to_freecad):
            path_to_freecad = os.path.dirname(path_to_freecad)
        print("Configured FreeCAD path:", path_to_freecad)
        if path_to_freecad not in sys.path:
            sys.path.append(path_to_freecad)
    else:
        print("FreeCAD path is not correct.")


try:
    try:
        import FreeCAD
    except ModuleNotFoundError:
        append_freecad_path()
    import FreeCAD  # noqa
    print("FreeCAD version:", FreeCAD.Version())
except ModuleNotFoundError as e:
    print("FreeCAD import failed.", e)


# ******************************************
and i just checked - with
`FreeCAD version: ['0', '19', '', 'https://code.launchpad.net/~vcs-imports/freecad/trunk', '2020/01/14 16:28:39']`
its the same.

i think this is not 'a realthunder thing' but more a real FreeCAD *core* thing...
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?

@yorik: what do you mean?

in
https://forum.freecadweb.org/viewtopic. ... 05#p343205
i have some test files linked.
you can directly find theme at:
- https://github.com/s-light/io_import_fc ... dy_objects BodyTest.FCStd
- https://github.com/s-light/io_import_fc ... ittleWorld MyLittleWorld.FCStd
- https://github.com/s-light/io_import_fc ... ng_example assembly_export.FCStd
vocx
Posts: 2829
Joined: Thu Oct 18, 2018 9:18 pm

Re: FreeCAD .FCStd importer for Blender 2.80

Post by vocx » Wed Jan 15, 2020 5:33 pm

s-light wrote:
Wed Jan 15, 2020 5:09 pm
i think this is not 'a realthunder thing' but more a real FreeCAD *core* thing...
Yes, but since August last year, realthunder has been changing a lot of the core code. This could be solved by him in a matter of minutes if he identifies the problem.
i have some test files linked.
I've been very lazy on this topic, which admitedly looks serious. However, your first test files and code seemed to me cumbersome. Too much information.

I'd like to ask you to prepare the absolutely simplest test file that you can think of. A single Body, a single feature, and a simple way to show the error.
To support the documentation effort, and code development, your donation is appreciated: paypal.
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 Jan 15, 2020 6:13 pm

ok - as you requested -
i stripped all the nice formatting off ;-)
here is the *minimal* version:


Image

BodyTest_Minimal.FCStd
and also attached:
BodyTest_Minimal.FCStd
(14.1 KiB) Downloaded 2 times
copy & paste for FreeCAD python console:
(source)

Code: Select all

import FreeCAD
print("FreeCAD version:", FreeCAD.Version())

objects = FreeCAD.ActiveDocument.Objects

print("doc.Objects", len(objects))

for o in objects:
    print(o, o.Name)
copy & paste for python3 REPL:
(source)

Code: Select all

import sys
path_to_freecad = "/usr/lib/freecad-daily-python3/lib/"
sys.path.append(path_to_freecad)

import FreeCAD
print("FreeCAD version:", FreeCAD.Version())

doc = FreeCAD.open("./BodyTest_Minimal.FCStd")
docname = doc.Name
objects = FreeCAD.ActiveDocument.Objects

print("doc.Objects", len(objects))

for o in objects:
    print(o, o.Name)

FreeCAD.closeDocument(docname)
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests