User:DeepSOIC: Difference between revisions

From FreeCAD Documentation
No edit summary
 
(18 intermediate revisions by the same user not shown)
Line 1: Line 1:
Mapping modes of the new Attacher
CompileOnWindows - reducing disk footprint


==Mode Deactivated==
Techniques to reduce disk space required for building FreeCAD on windows
'''References:''' any
==setting up MSVC2013 compiler without installing Visual Studio==
This is a short story of how I managed to set up FreeCAD compilation on Windows8.1 with MSVC2013 compiler without actually installing the huge visual studio express.


'''Action:''' sketch remains where it was. Attachment is disabled.
===getting the compiler===
First, I used another computer to install the full visual studio, in order to get the compiler files. I found the compiler under drive:\path\to\visual\studio\VC\bin


==Mode Translate==
Copied the compiler binaries and standard libraries to another computer. I copied the following folders to C:\Qt\msvc12rip
'''References:''' vertex
* drive:\path\to\visual\studio\VC\'''bin'''
* drive:\path\to\visual\studio\VC\'''lib'''
* drive:\path\to\visual\studio\VC\'''include'''


'''Action:''' sketch origin is translated to coincide with the vertex. Sketch orientation doesn't change, and can be modified by changing Placement property.
Then I installed Windows SDK (google for it). For those who don't know, it is a set of headers, libs and tools to compile Windows programs. By default, it installed itself to


[[image:Attacher_mode_Translate.png|250px]]
Then I installed CMake and Qt creator (just the creator, i.e. the environment, not the actual Qt, to save space).


Next was the trickiest part - to set up the compiler in Qt Creator.
===compiler in Qt Creator===
====32-bit====
Setting the compiler for 32 bit is quite straightforward.
1. Set up the compiler under Compilers tab in settings: Add a '''custom''' compiler:
* name = msvcrip (the name doesn't matter, it is up to you)
* Compiler path: C:\Qt\msvc12rip\VC\bin\cl.exe
* Make path: C:\Qt\msvc12rip\VC\bin\nmake.exe
* ABI: x86-windows-msvc2013-pe-32bit
* header paths - nothing
* error parser: MSVC
[[image:Msvc-no-vs_compiler-setup-32.png|600px]]


==Mode ObjectXY==
2. Under kits tab, I added a kit, and set it up like this:
'''References:''' object
* name: FreeCAD32 (again, up to you)
* Device type: Desktop
* Device: Local PC
* Compiler: msvcrip (or whatever you named it in step 1)
* Environment: (correct the paths to your setup)
{{code|code=
INCLUDE=C:\Program Files (x86)\Windows Kits\8.1\Include\um\;C:\Qt\msvc12rip\VC\include\
LIB=C:\Qt\msvc12rip\VC\lib\;C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x86\
LIBPATH=C:\Qt\msvc12rip\VC\lib\;C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x86\
PATH=C:\Qt\msvc12rip\VC\bin\;C:\Program Files (x86)\Windows Kits\8.1\bin\x86\;C:\Qt\git\bin\}}
Note the path to git.exe in PATH. It is optional, but if not specified, the version info will be incomplete in FreeCAD about.
* Debugger: (optional) set to 32-bit (x86)
* Qt version: None
[[image:Msvc-no-vs_kit-setup-32.png|600px]]


'''Action:''' sketching plane is XY plane of object's local coordinate system (according to its Placement property).
The environment part of the settings took me the most trouble to configure


[[image:Attacher_mode_ObjectXY.png|250px]]
====64-bit====
This was quite a bit more tricky to figure out how to do. The main problem was that there is no nmake executable in C:\Qt\msvc12rip\VC\bin\''''x86_amd64'''', and nmake kept using the 32-bit compiler. To counter the problem, I created a special folder "C:\Qt\msvc12rip\VC\bin\''''x86_amd64_sa''''", where I just combined the contents of folders C:\Qt\msvc12rip\VC\bin and C:\Qt\msvc12rip\VC\bin\x86_amd64. So, the instruction looks like this:


1. in C:\Qt\msvc12rip\VC\bin, create a folder named ''''x86_amd64_sa'''' (sa stands for Stand-Alone, use whatever name you like).


==Mode ObjectXZ==
2. copy contents of folder C:\Qt\msvc12rip\VC\bin into x86_amd64_sa folder (now you have a 32-bit compiler there)
'''References:''' object


'''Action:''' like ObjectXY.
3. copy contents of folder x86_amd64 into x86_amd64_sa, replacing some files in the process. Now you have a 64bit compiler with nmake there.


[[image:Attacher_mode_ObjectXZ.png|250px]]
4. Set up the compiler under Compilers tab in settings: Add a '''custom''' compiler:
* name = msvcrip'''64''' (the name doesn't matter, it is up to you)
* Compiler path: C:\Qt\msvc12rip\VC\bin\x86_amd64_sa\cl.exe
* Make path: C:\Qt\msvc12rip\VC\bin\x86_amd64_sa\nmake.exe
* ABI: x86-windows-msvc2013-pe-'''64bit'''
* header paths - nothing
* error parser: MSVC


5. Under kits tab, I added a kit, and set it up like this:
* name: FreeCAD'''64''' (again, up to you)
* Device type: Desktop
* Device: Local PC
* Compiler: msvcrip'''64''' (or whatever you named it in step 4)
* Environment: (correct the paths to your setup; compared to 32-bit, amd64/x64 has appeared or has replaced x86 in several places)
{{code|code=
INCLUDE=C:\Program Files (x86)\Windows Kits\8.1\include\shared\;C:\Program Files (x86)\Windows Kits\8.1\include\um\;C:\Qt\msvc12rip\VC\include
LIB=C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x64\;C:\Qt\msvc12rip\VC\lib\amd64\
LIBPATH=C:\Program Files (x86)\Windows Kits\8.1\References\CommonConfiguration\Neutral\
PATH=C:\Qt\msvc12rip\VC\bin\x86_amd64_sa\;C:\Program Files (x86)\Windows Kits\8.1\bin\x64\;C:\Qt\git\bin\}}
Note the path to git.exe in PATH. It is optional, but if not specified, the version info will be incomplete in FreeCAD about.
* Debugger: (optional) set to '''64'''-bit (x64)
* Qt version: None


==Mode ObjectYZ==
I have also set up another kit+compiler pair for using jom instead of nmake, to enable multicore build. The configuration was identical to 64-bit with nmake, except for that in path to Make in compiler tab, I set it to C:\Qt\Qt542\Tools\QtCreator\bin\jom.exe (you should be able to find jom under where your Qt creator is installed).
'''References:''' object


'''Action:''' like ObjectXY.
===testing compiler and building FreeCAD===
All the rest is identical to the normal way one would compile FreeCAD:


[[image:Attacher_mode_ObjectYZ.png|250px]]
Open FreeCAD (CMakeLists.txt) with Qt creator, and it will invite you to run cmake. Run it. CMake will build a test program, to see if the compiler works. If the compiler doesn't work, it will show an error telling exactly that, and listing the build output. This should help you identify, what's going wrong. Typical errors I got:
* Can't open Kernel32.lib - something's wrong with LIB or LIBPATH environment variables (note: they set under kits tab in Qt, not in windows!)
* can't resolve external symbol - something's wring with LIB or LIBPATH (they probably point to .lib-s of wrong bit-ness)
* manifest-related error: PATH does not point to a location where a resource compiler (rc.exe) of right bit-ness is located.
* can't locate include - the include location list should contain path to standard headers (C:\Qt\msvc12rip\VC\include on my machine)


To run FreeCAD built with type "Debug", debug versions of MSVC2013 redistributable libraries must be present somewhere reacheable through PATH (system-wide, this time).


==Mode FlatFace==
These dlls can be extracted from visual studio installer:
'''References:''' face or plane
* mount the downloaded .iso image as a disk (drive D: on my system)
* locate the files:
** D:\packages\vc_librarycore86\cab3.cab/F_REDIST_DLL_APPLOCAL_msvcp120d_x64
** D:\packages\vc_librarycore86\cab3.cab/F_REDIST_DLL_APPLOCAL_msvcr120d_x64
* extract the files, and name them "msvcp120d.dll", "msvcr120d.dll"
* copy the files to libpack folder, into bin


'''Action:''' legacy. Sketching on a flat face.
==avoiding copying any libpack files to launch FreeCAD==
The idea is very simple: instead of copying files - make links. On Windows, there are symbolic links to files. They appear to be where the link is, but actually reside somewhere else. To make them, one should use batch command '''mklink'''.


[[image:Attacher_mode_FlatFace.png|250px]]
I have come up with a batch script to automate the process of making links for each libpack's binary to FreeCAD build folder:
{{code|code=
@set libpackpath=C:\_vt\dev\PC\Qt\FreeCAD\libpack\active
@set builddir=%1
pushd %libpackpath%\bin
for %%i in (*) do mklink "%builddir%\bin\%%i" "%libpackpath%\bin\%%i"
for /D %%s in (*) do mklink /d "%builddir%\bin\%%s" "%libpackpath%\bin\%%s"
popd
pause
}}
You'll have to modify the path to libpack to match yours. Then, feed FreeCAD build folder path (full path!) to the script as an argument. Note: the batch may fail, if there are spaces in paths (it may work, but it is untested).



This batch must be run with administrator privileges (or, you can set to allow users use mklink in local security policy settings in Windows)
==Mode TangentPlane==
'''References:''' face+vertex or vertex+face

'''Action:''' sketching plane is tangent to surface of face at the point on the surface that is closest to the vertex. If vertex is linked in first, the plane is translated to go through the vertex. If face is first, the plane touches the surface. X axis of sketch is chosen to go along internal face's parametrization.

[[image:Attacher_mode_TangentPlane.png|250px]]


==Mode NormalToEdge==
'''References:''' edge or edge+vertex or vertex+edge

'''Action:''' sketching plane is normal to the edge at the point of the edge's curve that is closest to the vertex (or defined by MapPathParameter property, if vertex is not linked). The origin of sketch is translated to the vertex if the virtex is first, or kept at where the curve pierces the sketch plane if edge is first. X axis of sketch is chosen automatically.

[[image:Attacher_mode_NormalToEdge.png|250px]]


==Mode FrenetNB==
'''References:''' curved edge OR curved edge+vertex OR vertex+curved edge

'''Action:''' sketching plane is normal-binormal (NB) axes of Frenet-Serret coordinates at the point of the edge's curve that is closest to the vertex (or defined by MapPathParameter property, if vertex is not linked). The origin of sketch is translated to the vertex if the vertex is first, or kept at the curve if edge is first. This mode is similar to NormalToEdge, except that X axis is well-defined.

[[image:Attacher_mode_FrenetNB.png|250px]]


==Mode TrenetTN==
'''References:''' curved edge OR curved edge+vertex OR vertex+curved edge

'''Action:''' sketching plane is tangent-normal (TN) axes of Frenet-Serret coordinates at the point of the edge's curve that is closest to the vertex (or defined by MapPathParameter property, if vertex is not linked). The origin of sketch is translated to the vertex if the vertex is first, or kept at the curve if edge is first. Effectively, if the curve is planar, the sketching plane is the plane of the curve.

[[image:Attacher_mode_FrenetTN.png|250px]]


==Mode FrenetTB==
'''References:''' curved edge OR curved edge+vertex OR vertex+curved edge

'''Action:''' sketching plane is tangent-binormal (TB) axes of Frenet-Serret coordinates at the point of the edge's curve that is closest to the vertex (or defined by MapPathParameter property, if vertex is not linked). The origin of sketch is translated to the vertex if the vertex is first, or kept at the curve if edge is first.

[[image:Attacher_mode_FrenetTB.png|250px]]


==Mode Concentric==
'''References:''' curved edge OR curved edge+vertex OR vertex+curved edge

'''Action:''' same as FrenetTN, but sketch origin is placed at the center of curvature of the edge.

[[image:Attacher_mode_Concentric.png|250px]]


==Mode SectionOfRevolution==
'''References:''' curved edge OR curved edge+vertex OR vertex+curved edge

'''Action:''' same as FrenetNB, but sketch origin is placed at the center of curvature of the edge, and Y axis is the axis of osculating circle. Useful to make grooves on bodies of revolution.

[[image:Attacher_mode_SectionOfRevolution.png|250px]]


==Mode ThreePointsPlane==
'''References:''' vertex+vertex+vertex or line+vertex or vertex+line or line+line

'''Action:''' sketching plane goes through three vertices defined by references. Line is treated as if it is two vertices.

[[image:Attacher_mode_ThreePointsPlane.png|250px]]


==Mode ThreePointsNormal==
'''References:''' vertex+vertex+vertex or line+vertex or vertex+line or line+line

'''Action:''' sketching plane contains first two vertices, and is normal to the plane defined by three vertices.

[[image:Attacher_mode_ThreePointsNormal.png|250px]]


==Mode Folding==
'''References:''' line+line+line+line

'''Action:''' specialty mode to fold polyhedra. See picture. It is required that all four lines share an endpoint. It is not required that both leafs to fold together are the same, like on the picture.

[[image:Attacher_mode_Folding.png|250px]]

Latest revision as of 17:21, 1 July 2015

Mapping modes of the new Attacher

Mode Deactivated

References: any

Action: sketch remains where it was. Attachment is disabled.

Mode Translate

References: vertex

Action: sketch origin is translated to coincide with the vertex. Sketch orientation doesn't change, and can be modified by changing Placement property.


Mode ObjectXY

References: object

Action: sketching plane is XY plane of object's local coordinate system (according to its Placement property).


Mode ObjectXZ

References: object

Action: like ObjectXY.


Mode ObjectYZ

References: object

Action: like ObjectXY.


Mode FlatFace

References: face or plane

Action: legacy. Sketching on a flat face.


Mode TangentPlane

References: face+vertex or vertex+face

Action: sketching plane is tangent to surface of face at the point on the surface that is closest to the vertex. If vertex is linked in first, the plane is translated to go through the vertex. If face is first, the plane touches the surface. X axis of sketch is chosen to go along internal face's parametrization.


Mode NormalToEdge

References: edge or edge+vertex or vertex+edge

Action: sketching plane is normal to the edge at the point of the edge's curve that is closest to the vertex (or defined by MapPathParameter property, if vertex is not linked). The origin of sketch is translated to the vertex if the virtex is first, or kept at where the curve pierces the sketch plane if edge is first. X axis of sketch is chosen automatically.


Mode FrenetNB

References: curved edge OR curved edge+vertex OR vertex+curved edge

Action: sketching plane is normal-binormal (NB) axes of Frenet-Serret coordinates at the point of the edge's curve that is closest to the vertex (or defined by MapPathParameter property, if vertex is not linked). The origin of sketch is translated to the vertex if the vertex is first, or kept at the curve if edge is first. This mode is similar to NormalToEdge, except that X axis is well-defined.


Mode TrenetTN

References: curved edge OR curved edge+vertex OR vertex+curved edge

Action: sketching plane is tangent-normal (TN) axes of Frenet-Serret coordinates at the point of the edge's curve that is closest to the vertex (or defined by MapPathParameter property, if vertex is not linked). The origin of sketch is translated to the vertex if the vertex is first, or kept at the curve if edge is first. Effectively, if the curve is planar, the sketching plane is the plane of the curve.


Mode FrenetTB

References: curved edge OR curved edge+vertex OR vertex+curved edge

Action: sketching plane is tangent-binormal (TB) axes of Frenet-Serret coordinates at the point of the edge's curve that is closest to the vertex (or defined by MapPathParameter property, if vertex is not linked). The origin of sketch is translated to the vertex if the vertex is first, or kept at the curve if edge is first.


Mode Concentric

References: curved edge OR curved edge+vertex OR vertex+curved edge

Action: same as FrenetTN, but sketch origin is placed at the center of curvature of the edge.


Mode SectionOfRevolution

References: curved edge OR curved edge+vertex OR vertex+curved edge

Action: same as FrenetNB, but sketch origin is placed at the center of curvature of the edge, and Y axis is the axis of osculating circle. Useful to make grooves on bodies of revolution.


Mode ThreePointsPlane

References: vertex+vertex+vertex or line+vertex or vertex+line or line+line

Action: sketching plane goes through three vertices defined by references. Line is treated as if it is two vertices.


Mode ThreePointsNormal

References: vertex+vertex+vertex or line+vertex or vertex+line or line+line

Action: sketching plane contains first two vertices, and is normal to the plane defined by three vertices.


Mode Folding

References: line+line+line+line

Action: specialty mode to fold polyhedra. See picture. It is required that all four lines share an endpoint. It is not required that both leafs to fold together are the same, like on the picture.