Giter VIP home page Giter VIP logo

sketchupnet's People

Contributors

keqli avatar moethu avatar tonyhuangyj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sketchupnet's Issues

Doesn't work on all skp files?

For some reason some skp files are perfectly readable except for the fact that it shows 0 surfaces, all the other stuff is there, like components, instances, materials, etc. But for some reason some files return 0 surfaces.

GetString has a bug

static System::String^ GetString(SUStringRef name)

		{			
			size_t name_length = 0;
			SUStringGetUTF8Length(name, &name_length);
			if (name_length==0) {
				return System::String::Empty;
			}
			char* name_utf8 = new char[name_length + 1];
			SUStringGetUTF8(name, name_length + 1, name_utf8, &name_length);
			SUStringRelease(&name);
			
			System::String^ s1= gcnew System::String(name_utf8,0,name_length,System::Text::Encoding::UTF8);
			//System::String^ s2= gcnew System::String(name_utf8);			
			return s;
		}

System::String^ s2= gcnew System::String(name_utf8);
If you are in use other language,s2 return error string. replace it with
System::String^ s1= gcnew System::String(name_utf8,0,name_length,System::Text::Encoding::UTF8);

writing components and groups support

Is support writing components and groups when creating a new model?
The WriteNewModel method seems to handle only faces, edges, and curves.

SUEntitiesAddFaces(entities, Surfaces->Count, Surface::ListToSU(Surfaces));
SUEntitiesAddEdges(entities, Edges->Count, Edge::ListToSU(Edges));
SUEntitiesAddCurves(entities, Curves->Count, Curve::ListToSU(Curves));

dependecies issue

Hi , i have developed a tool and it worked on my machine , but when i transferred the build process to the server , i got FileNotFoundException on sketchupNet.dll later i tried to reinstall the runtime witch is given in a Requirements but aint no effect on this. So try after try i managed to clone this whole repository and noticed tha c++ development package was needed , after installing it now it works on the server.

So i dont know what exactly is missing. but maybe if it would be a good test to create clean windows Virtual machine and try to figure out what exactly is needed for the full dependency list.

Seems not to work with current version of Sketchup anymore

Hi there!
Thanks for the great work! I tried to get this working and have been able to build and run a console .NET app that uses your SketchUpNET library, but I have not been able to load a .SKP file that was created with a recent version of sketchup.
I guess this is probably because the library is implemented for an outdated sketchup api version, right?
Is there any chance you could provide it for the current version of sketchup?
Or could I send you the .SKP file so that you can tell me what I am doing wrong?
I would also be ok to pay you as an compensation for your efforts if you can help...
Thanks and best regards.
Florian

Rebuild GH package

Untitled
There seems to be some issue with the SketchUpNET.dll file when trying to run the Grasshopper file. @moethu can you please try rebuilding or modifying it so that it can run with Grasshopper for Rhino 6? I'm interested in contributing to the Grasshopper part of this project, but I'm no good with C++ at all. Thanks!

SketchUpNET could not load file or assembly

my project c# console
i add the library on project and build success but when run the project get the error
could not load file or assembly.....
i change build mode x86 x64 any cpu
downloaded files SketchUpNET build 180818.zip

Gentle Feature Request: Sketchup.LoadModel solids output (components)

Hello Maximilian,

I am wondering if it would be possible to load sketchup components as solids, or at least as @L2 lists of surfaces. Right now the model comes in as a large list of surfaces. Joining surfaces by polysurfaces and making solids out of those to be exported into revit only works as long as no geometry intersects.

Importing something such as this, and having each object show up requires importing each component separately and moving them into the same position within Revit:

image

Having that feature would enable me to be to create solids out of sketchup models (such as furniture made by a landscape architect in sketchup, where the seat of the chair (a component) intersects the arms of the chair (another component)). By sorting each component into its own list, we would be able to bring in those components as individual solids into our revit environment.

If you think this is doable, I would love to work with you on this and try and write it.

Thanks,
kv2

Cannot load models, when filepath contains special characters (ä, ö, ü, ß, ...)

As the title already says, it's not possible to load models when the filepath (filename and folderpath) contains special (in this case german) characters (ä, ö, ü, ß, ...). I'm using this library in a VB.NET WPF application and apart from this it works perfectly fine. But i couldn't find a solution to this on my applications side.

Is it possible to fix this problem? I'm not that experienced when it comes to C/C++...

How to handle Surfaces part of a component but not an instance?

Each vertice that is part of a surface which is part of an instance you can use .GetTransformed on and you get the correct position of the vertice to build your mesh but some components aren't part of an instance and contain surfaces that aren't part of an instance so how do you go about positioning those vertices in the correct place?

Sorry I have to ask it here but I don't know where else to go, the documentation on SketchUp file structures is very limited.

Nuget version 1.7.2 not up to date

Hi

Is it possible to update the nuget version to 1.7.3 and fix the problem below?

I have exactly the same problem as #51
by either using:

  • nuget version 1.7.2
  • github version 1.7.3

So I can't get it to work, no matter what version I use.
I use VS2022.

Thanks in advance!

Would it be possible to run this package on .net framework 4.8 ?

Im trying to test this lib. on 4.8 .net framework and get:
System.BadImageFormatException: 'Could not load file or assembly 'SketchUpNET, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.'
How to solve this, as 4.0 .net framework is no longer available for download

bug: SketchUp.LoadModel don't support other country's language

Scene:
SketchUp skp = new SketchUp();
var bRtn = skp.LoadModel(“c:\TestModel - 副本.skb”, true);
but return false。
in bool LoadModel(System::String^ filename, bool includeMeshes),
Fix it:

		#pragma region Convert System::String to const char* by utf8 encoding
		array<unsigned char>^ bytes = System::Text::Encoding::UTF8->GetBytes(filename);
		char* path = new char[bytes->Length + 1];
		path[bytes->Length] = 0;
		int i = 0;
		for each(unsigned char c in bytes) {
			path[i++] = c;
		}
                    //complete to delete path.
		#pragma endregion

		//msclr::interop::marshal_context oMarshalContext;			
		//const char* path = oMarshalContext.marshal_as<const char*>(filename);
		SUInitialize();

Contact?

Hi,

is there any way to get in contact with you? Sorry for misusing an Issue for this but I failed to find another way...

Can't create new layers and groups with latest package.

Hi, I've tried to create new layers and groups with the package 1.7.2 (NuGet) and 1.7.3 (latest release)
but none of them work for the functionalities,

although I've successfully wrote a file with geometries by following the tutorial,
the layer of each geometry remained on "Layer0",

how can I solve this?

Thank you for sharing your library, this helps me a lot since I have no experience in C API development.
Thank you :]

Having trouble creating a surface with a hole in it.

I am getting weird results when trying to create a surface with a hole in it. In order to test my code, I created a square with a square hole in Sketchup. I opened the file and created code from all the values in the opened file (second part of code.txt). Finally I just tried opening the file and saving it and I get the same results. The shape is merged together.

Any suggestions?
Thank you

Input

SketchUpNET.SketchUp skp = new SketchUpNET.SketchUp();
if (skp.LoadModel("Input.skp"))
{
	skp.WriteNewModel("new.skp", SKPVersion.V2017);
}

Output
Sketchup.zip

Attribute for Dynamic Component support

I have a SKP file with Dynamic Component and some Attributes like Name, Summary, Description, lenX, lenY, lenZ...etc information inside.
Could you support to read this information? thank you

Implement Scenes & References

SketchUp makes use of scenes to hide and show a specified set of layers. It would be nice if there was a reference to these scenes.

Allow material inheritance from groups or instances on default materials

no link FaceBackMaterial in group?
//Function is
//static Surface^ FromSU(SUFaceRef face, bool includeMeshes, System::Collections::Generic::Dictionary<String^, Material^>^ materials)
SUMaterialRef mback = SU_INVALID;
SUFaceGetBackMaterial(face, &mback); //Error mback is 0x00
SUStringRef mbackNameRef = SU_INVALID;
SUStringCreate(&mbackNameRef);
SUMaterialGetName(mback, &mbackNameRef);

//test file is
1.zip

.NET Core support (and Linux and macOS)

AFAIK SketchUpNET only works on Windows right? You are using a vcxproj project, that has C++ sources.

This articles discusses how to port a C++ project to .NET Core: https://docs.microsoft.com/en-us/dotnet/core/porting/cpp-cli. However, it notes that C++/CLI support for .NET Core is Windows only. Support for macOS or Linux isn't probably to come (for a long time).

They recommend using platform invoke to support .NET core. What's your view on this? Do you have any plans on making it work for .NET Core (and thereby Linux and macOS)?

System.IO.FileNotFoundException with Nuget Package

IDE:VS2022(x64 17.1)
Package:SketchUpNET 1.7.2 from Nuget with Nuget Package Manager
Project:both Console(.Net Core but change targetframework .net 6.0 to .net462) and Console(.Net Framework 4.6.2)
Code:
`using System;
using SketchUpNET;

namespace ConsoleApp
{
class Program
{
static void Main(string[] args)
{
SketchUp skp = new SketchUp();
if (skp.LoadModel(@"E:\test.skp"))
{
Console.WriteLine("TEST");
}
}
}
}`

Error:Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly "SketchUpNET.dll" or it's referrences.

NuGet Package

Is it possible to create a NuGet package for this awesome library?

Materials not being saved to SKP file

Hi

I have been trying to use your library and have found that my materials are not being saved to the SKP file.

I have created the following as an example. My main code creates faces etc but I removed them for this example.

I would assume the Material called "MyColor" would be saved to the SKP File.

         static void test3()
        {
            Color c = new Color(255, 0, 0, 255);
            Material backMaterial = new Material("MyColor", c, false, 1, true, false, null);

            SketchUpNET.SketchUp skp = new SketchUpNET.SketchUp();
            if (skp.LoadModel(@"c:\temp\chris1.skp", true) == false)
            {
                return;
            }

            skp = new SketchUpNET.SketchUp();
            skp.Surfaces = new List<SketchUpNET.Surface>();
            skp.Edges = new List<SketchUpNET.Edge>();
            skp.Curves = new List<SketchUpNET.Curve>();
            skp.Groups = new List<SketchUpNET.Group>();
            skp.Instances = new List<Instance>();
            skp.Components = new Dictionary<string, Component>();
            skp.Layers = new List<SketchUpNET.Layer>();
            skp.Layers.Add(new SketchUpNET.Layer("Chris"));
            skp.Materials = new Dictionary<string, Material>();
            skp.Materials.Add("Red", backMaterial);

            System.IO.File.Delete(@"c:\temp\chris1.skp");
            skp.WriteNewModel(@"c:\temp\chris1.skp");
        }

Have I done something wrong?

I am using SketchUpNET-build-180818 (precompiled binaries)

Chris

Can not load SketchUpNET.dll

VS 2022 using x64

I installed 1.7.2 via Nuget and tried to run your example code. I get an exception

"System.IO.FileNotFoundException: 'Could not load file or assembly 'SketchUpNET.dll' or one of its dependencies. The specified module could not be found.'"

I tried deleting the reference and downloading the 1.7.3 dll and referencing that instead. Same error.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.