Adding dimension lines to model

dimensions

#1

I am attempting to add linear dimension lines to a entity collection. There does not appear to be a function for doing this like there are for guide lines and other entities (SUEntitiesAdd…), so how is this done? If this is not possible in the current version of the SKD, is there a way to add text to an entity collection?


#2

See this doc:
http://extensions.sketchup.com/developer_center/sketchup_c_api/sketchup/dimension__linear_8h_source.html


#3

I see how to create a dimension line, but how do I add it to the entity collection? Does merely attaching it to an entity via an SUInstancePathRef cause it to be a part of the entity collection? The Ruby API has this: http://ruby.sketchup.com/Sketchup/Entities.html#add_dimension_linear-instance_method, but the C SDK does not appear to have this method listed in the documentation.


#4

NO. A dimension object can span between two separate objects (which can be nested in separate components.)

See also this:
http://extensions.sketchup.com/developer_center/sketchup_c_api/sketchup/dimension_8h_source.html

I do not know for sure. Perhaps it’s function was overlooked ?

@bugra ?


#5

So if dimension lines are not possible, what about free floating text? This method seems to be missing from the C SDK as well. If the C SDK is not feature complete, is there still a way to get the old C++ SDK?


#6

It may be that they wish them to be made in a LayOut document:
http://extensions.sketchup.com/developer_center/layout_c_api/layout/lineardimension_8h.html

When they are, they’d be in paperspace, so would only be a member of the document’s (or page’s) entities collection.

This is the leader “callout” object. Yes I do not see it listed anywhere in the SketchUp C API.

Nor do I see the view-based screen note object, ie, the equiv. of Model#add_note();
nor any function equiv. of Entities#add_3d_text().

@Paul, @bugra ?

The old C++ API is about to be deprecated. No more work fixing it or adding to it will be done. It is also likely that it’s libraries will cease to be compiled and/or distributed for newer SketchUp versions.

ADD: The SkpWriter.dll has long been deprecated. But the C++ SketchUpReader.dll is still distro’d with the SDK in the “deprecated” folder.


#7

Hi Jbills,

Have you tried using the SUDimensionLinearToDimension to cast your SULinearDimensionRef to an SUDimensionRef, then used SUDimensionToEntity to get an SUEntityRef? You should be able to then add that SUEntityRef to an entity collection. It sounds like it would be nice for us to add a SUDimensionLinearToEntity method to cast SULinearDimensionRef directly to SUEntityRef.

Hope this helps,
Adam


#8

I do not see how that helps. Entity collections do not have a generic add entity function either. Can you cast any generic entity to a component instance then add it via the add component instance function? http://extensions.sketchup.com/developer_center/sketchup_c_api/sketchup/entities_8h.html#a56a63c45cd09b148ca9d2c0bbf1d256e


#9

I have just tested casting a linear dimension to a dimension to an entity to a component instance, and it does not work. It seems there is no way to add an arbitrary entity to an entity collection.


#10

I didn’t think there was. It would be beyond the norm to have to do it this way.

These SDK classes need C “factory” functions, that wrap the C++ object constructors, that create them as members of the proper C++ entities collection.
(Same as in the Ruby API.)


#12

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.