diff --git a/SketchUpNET/Camera.cpp b/SketchUpNET/Camera.cpp new file mode 100644 index 0000000..d357221 --- /dev/null +++ b/SketchUpNET/Camera.cpp @@ -0,0 +1,88 @@ +/* + +SketchUpNET - a C++ Wrapper for the Trimble(R) SketchUp(R) C API +Copyright(C) 2015, Autor: Maximilian Thumfart + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "utilities.h" +#include "Vector.h" +#include "Vertex.h" + + +using namespace System; +using namespace System::Collections; +using namespace System::Collections::Generic; + +namespace SketchUpNET +{ + public ref class Camera + { + public: + + Vector^ Up; + Vertex^ Position; + Vertex^ Target; + bool Perspective; + double FOV; + + Camera(Vertex ^ position, Vertex ^ target, Vector^ up, bool perspective, double fov) + { + this->Up = up; + this->Position = position; + this->Target = target; + this->FOV = fov; + this->Perspective = perspective; + }; + + Camera() {}; + internal: + static Camera^ FromSU(SUCameraRef cam) + { + SUPoint3D pos = SU_INVALID; + SUPoint3D target = SU_INVALID; + SUVector3D up = SU_INVALID; + SUCameraGetOrientation(cam, &pos, &target, &up); + + + double fov = 0; + SUCameraGetPerspectiveFrustumFOV(cam, &fov); + bool persp = true; + SUCameraGetPerspective(cam, &persp); + + Camera^ c = gcnew Camera(Vertex::FromSU(pos), Vertex::FromSU(target), Vector::FromSU(up), persp, fov); + return c; + }; + + }; + + + + +} \ No newline at end of file diff --git a/SketchUpNET/Camera.h b/SketchUpNET/Camera.h new file mode 100644 index 0000000..a55ad4c --- /dev/null +++ b/SketchUpNET/Camera.h @@ -0,0 +1,21 @@ +/* + +SketchUpNET - a C++ Wrapper for the Trimble(R) SketchUp(R) C API +Copyright(C) 2015, Autor: Maximilian Thumfart + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ +#include "Camera.cpp" \ No newline at end of file diff --git a/SketchUpNET/Scene.cpp b/SketchUpNET/Scene.cpp new file mode 100644 index 0000000..17adc39 --- /dev/null +++ b/SketchUpNET/Scene.cpp @@ -0,0 +1,97 @@ +/* + +SketchUpNET - a C++ Wrapper for the Trimble(R) SketchUp(R) C API +Copyright(C) 2015, Autor: Maximilian Thumfart + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "utilities.h" +#include "Camera.h" +#include "Layer.h" + + +using namespace System; +using namespace System::Collections; +using namespace System::Collections::Generic; + +namespace SketchUpNET +{ + public ref class Scene + { + public: + + Vertex ^ Start; + Vertex^ End; + System::String^ Layer; + + Scene(Vertex ^ start, Vertex ^ end, System::String^ layer) + { + this->Start = start; + this->End = end; + this->Layer = layer; + }; + + Scene() {}; + internal: + static Scene^ FromSU(SUSceneRef scene) + { + SUStringRef name = SU_INVALID; + SUStringCreate(&name); + SUSceneGetName(scene, &name); + String^ n = SketchUpNET::Utilities::GetString(name); + + SUCameraRef cam = SU_INVALID; + SUSceneGetCamera(scene, &cam); + + + //Get All Layers + size_t layerCount = 0; + SUSceneGetNumLayers(scene, &layerCount); + + if (layerCount > 0) { + std::vector layers(layerCount); + SUSceneGetLayers(scene, layerCount, &layers[0], &layerCount); + + for (size_t i = 0; i < layerCount; i++) { + Layer^ layer = Layer::FromSU(layers[i]); + layer.Name + + } + } + + }; + + + + + }; + + + + +} \ No newline at end of file diff --git a/SketchUpNET/Scene.h b/SketchUpNET/Scene.h new file mode 100644 index 0000000..dafea89 --- /dev/null +++ b/SketchUpNET/Scene.h @@ -0,0 +1,21 @@ +/* + +SketchUpNET - a C++ Wrapper for the Trimble(R) SketchUp(R) C API +Copyright(C) 2015, Autor: Maximilian Thumfart + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ +#include "Scene.cpp" \ No newline at end of file diff --git a/SketchUpNET/SketchUpNET.vcxproj b/SketchUpNET/SketchUpNET.vcxproj index d0bcf7d..013a0c3 100644 --- a/SketchUpNET/SketchUpNET.vcxproj +++ b/SketchUpNET/SketchUpNET.vcxproj @@ -148,6 +148,7 @@ + @@ -159,6 +160,7 @@ + @@ -168,6 +170,7 @@ + @@ -180,6 +183,7 @@ + diff --git a/SketchUpNET/SketchUpNET.vcxproj.filters b/SketchUpNET/SketchUpNET.vcxproj.filters index 9bb8fe9..cb3044a 100644 --- a/SketchUpNET/SketchUpNET.vcxproj.filters +++ b/SketchUpNET/SketchUpNET.vcxproj.filters @@ -69,6 +69,12 @@ Source Files + + Source Files + + + Source Files + @@ -125,6 +131,12 @@ Header Files + + Header Files + + + Header Files +