Mod folder VS pivy module!

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
abghrnjd
Posts: 43
Joined: Tue Dec 22, 2020 12:02 pm

Mod folder VS pivy module!

Post by abghrnjd »

I'm writing a macro in VScode as an external editor. I use a .env file to introduce modules to VScode:

Code: Select all

FREECAD_LIB=C:\Program Files\FreeCAD 0.19\bin
FREECAD_LIB_two=C:\Program Files\FreeCAD 0.19\lib
FREECAD_LIB_three=C:\Program Files\FreeCAD 0.19\Ext
FREECAD_LIB_four=C:\Program Files\FreeCAD 0.19\bin\Lib
FREECAD_MOD=C:\Program Files\FreeCAD 0.19\Mod
FREECAD_MOD_two=C:\Users\Abbas\AppData\Roaming\FreeCAD\Mod\A2plus
FREECAD_STUBS=C:\Program Files\FreeCAD 0.19\freecad-stubs-master\out
PYTHONPATH=${FREECAD_LIB};${FREECAD_LIB_two};${FREECAD_LIB_three};${FREECAD_LIB_four};${FREECAD_MOD};${FREECAD_MOD_two};${FREECAD_STUBS};${PYTHONPATH}
I also need to import pivy into my code some where:

Code: Select all

from pivy import coin
this means I have to add this line to .env file!

Code: Select all

C:\Program Files\FreeCAD 0.19\bin\Lib\site-packages
as FREECAD_LIB_five

BUT when I add this line, FreeCAD Gui doesn't show up, Nothing happens! my whole code doesn't run any more!
How can I solve this paradox?
abghrnjd
Posts: 43
Joined: Tue Dec 22, 2020 12:02 pm

Re: Mod folder VS pivy module!

Post by abghrnjd »

I copied the whole pivy folder into mod folder. it Solved the problem. VS code finds it there!
edwilliams16
Veteran
Posts: 3179
Joined: Thu Sep 24, 2020 10:31 pm
Location: Hawaii
Contact:

Re: Mod folder VS pivy module!

Post by edwilliams16 »

What does the .env file do for you? Does it get completion working? I've not managed that. Where else do those environment variables you define appear?

I imagine soft-linking into your Mod directory would also work and be tidier.
abghrnjd
Posts: 43
Joined: Tue Dec 22, 2020 12:02 pm

Re: Mod folder VS pivy module!

Post by abghrnjd »

edwilliams16 wrote: Mon Jul 19, 2021 8:52 pm What does the .env file do for you? Does it get completion working? I've not managed that. Where else do those environment variables you define appear?

I imagine soft-linking into your Mod directory would also work and be tidier.
I'd never heard of soft/hard linking! looks like a great idea. :idea:
How is it possible on Freecad installed in windows?
edwilliams16
Veteran
Posts: 3179
Joined: Thu Sep 24, 2020 10:31 pm
Location: Hawaii
Contact:

Re: Mod folder VS pivy module!

Post by edwilliams16 »

Symlinks how been in Unix since Day 1 - and since under the hood OSX is Unix, it's there on Macs. I'm not very familiar with Windows, but a quick google gave https://www.maketecheasier.com/create-s ... windows10/
User avatar
HakanSeven12
Veteran
Posts: 1481
Joined: Wed Feb 06, 2019 10:30 pm

Re: Mod folder VS pivy module!

Post by HakanSeven12 »

Maybe you can create a tutorial about VScode-FreeCAD.
abghrnjd
Posts: 43
Joined: Tue Dec 22, 2020 12:02 pm

Re: Mod folder VS pivy module!

Post by abghrnjd »

HakanSeven12 wrote: Tue Jul 20, 2021 5:50 am Maybe you can create a tutorial about VScode-FreeCAD.
It's a good challenge, very tempting to learn, but a real pain in the neck to implement... countless, complicated errors rise up when you start. you must have a good knowledge in programming to be comfortable with this approach. I know very little.
Post Reply