Saturday, December 2, 2023
Home3D ModelingItems in a SketchUp mannequin and faces with quick edges - SketchUp...

Items in a SketchUp mannequin and faces with quick edges – SketchUp SDK


Hello,

I used to be performing some work on the Rhino to SketchUp export plugin lately and I seen a TODO I had made about setting the items within the SketchUp file if Rhino’s items had been one of many SUModelUnits enums (setting a scale issue based mostly on our items to inches in any other case). I see a SUModelGetUnits perform within the SDK however no SUModelSetUnits, so until the Rhino mannequin was in inches I’m at all times scaling. How do you set the unit system on a SUModelRef? Only for grins I attempted altering the unit system in SketchUp 2016 too however couldn’t determine that out both. Are you guys simply inches now and SUModelGetUnits is for legacy information?

The explanation I even began wanting on the unit system once more is I seen that edges smaller than about .002 inches don’t get changed into faces proper once I deliver a mannequin exported from Rhino into SketchUp. It’s high-quality to have a part with a scale rework that makes it smaller however not if the geometry itself has edges shorter than that. Is that imagined to occur? Is there a sure size, beneath which stuff doesn’t work proper? I used to be going to pop up a message field to warn customers after they have geometry which may not open proper in SketchUp however I wished to ensure I acquired it proper.

Tim

Forgot to say. Seems to be just like the model of the SDK we’re utilizing (based mostly on the .dll model data) is 16.0.19912.0.

I’d wish to resurrect this thread. Can we please have a easy technique of setting the unit system on the mannequin in C API? The analog of SUModelGetUnits however for setting (ie. SUModelSetUnits). Is this tough to do? If there isn’t any different means than utilizing the choices supervisor stuff, are you able to please give us a transparent instance in C, or level us to at least one if one already exists. I simply downloaded SDK_WIN_x64_2021-0-339 and I can’t discover something within the samples.

Thanks.

Tim

Hello Dan,

I don’t care in regards to the edge stuff. I dealt with that a very long time in the past. Not lengthy after I acquired crickets from my preliminary submit.

Right here’s what I can inform you is reality as a result of I can reveal it. When you make a mannequin in SketchUp with the items set to meters, for instance, and make a field that’s 3x4x5m. Save that mannequin as a .skp file. You may open that file in Rhino and ensure that the items had been set to meters and the field is 3x4x5m. I do know that it’s utilizing the unit system from SUModelGetUnits as a result of I wrote the Rhino plugin that opens SketchUp information.

What I at the moment do on export is scale the mannequin from no matter unit system Rhino is utilizing to inches as a result of there isn’t any solution to set the mannequin’s unit system, with the SDK, that I perceive. I’d just like the person to have the ability to make a mannequin in Rhino utilizing a unit system that SketchUp supposedly helps:

@enum SUModelUnits
@temporary Items choices settings
*/
enum SUModelUnits {
SUModelUnits_Inches,
SUModelUnits_Feet,
SUModelUnits_Millimeters,
SUModelUnits_Centimeters,
SUModelUnits_Meters
};

so {that a} person can roundtrip a SketchUp file and protect the items as an alternative of getting them transformed to inches.

Tim

I by no means noticed the unique submit. And I’m bowing out of this subject now. All I’ll say concerning this …

… is that once more, all the pieces internally in SketchUp, LayOut and their file codecs is in inches.

I humbly apologize. I simply regarded on the import code. Whereas I do get the unit system from the file utilizing SUModelGetUnits, I’m scaling the geometry with a unit scale from inches to regardless of the unit system SUModelGetUnits returns. So you might be proper, inches internally whatever the unit system.

I suppose I’ll let this relaxation. Nevertheless, if the SkectchUp API devs ever do any unit system updates are you able to please let me know. I suppose I’ll get notified through e mail if you happen to reply to this discussion board submit.

Tim

That might be a significant change. It will definitely be messaged if that ever occurred.

:pinched_fingers:

In all seriousness although, if one can save a SketchUp file in Meters from SketchUp (even when it a show factor and never inside). Why can’t you code it in order that mentioned show person possibility is ready to meters inside an exporter?

Solely a human can get into Mannequin Data>Items and alter it to Meters with a mouse click on? Like no different laptop quantum laptop in 2023 can entry that variable and set the worth to Meters via code?

You may. A number of inbuilt exporter have already got this selection.

No.

You do not want a quantum laptop (SketchUp doesn’t run on it anyway…). You simply must learn to write correct code to set.



1 Like

I’m unsure what your backside line is.

Are you questioning the best way to accomplish items conversion in an exporter you write your self? In that case, you must take a look at the UnitsOptions within the mannequin’s choices dictionary and its key,worth pairs. I can’t inform you precisely the place to search out these within the SDK as I don’t use it, I get them from the SketchUp Ruby API. In case you are satisfied they’ve been omitted there (which appears unlikely), you would submit a request so as to add them.

Are you questioning why they aren’t current in among the exporters? I be aware that there are choices to set items within the choices in a number of of the present exporters however not in others. And within the ones that supply this selection, the mannequin items are the default. In case you are particularly asking about a number of exporters that don’t provide the choice, you would rephrase your query to be particular about them.

In case you are questioning why SketchUp makes use of inches as its inside items whatever the show items of the GUI, that’s a completely completely different matter that was mentioned a few years in the past on this subject. Whatever the state of the world about items of measurement, this isn’t more likely to change. The devs have said that inside items are finally arbitrary and so they don’t see a adequate cause to undertake an enormous rework of the code base to vary them.

@dezmo I used to be primarily utilizing hyperboles.
@slbaumgartner I’m not a developer myself. Was speaking about Rhino exporter which @tim appears to have developed.

If that is so I take all of it again.

@tim Would this be potential to do for Rhino exporter? It will be tremendously appreciated. I learn your touch upon the youtrack entry for maintaining items in Rhino exporter through which you mentioned it was “unlikely to vary” however these guys right here telling it must be potential? Thanks.

I’m unsure they’re speaking about exporters in different apps that use the SDK to go to SU. I believe they’re speaking about exporters in SU to go to different codecs. If I’m confused, somebody please chime in.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments