Hiding Edges in Sketchup SDK


#1

I think I am doing somthing wrong. I am trying to hide the edges of my model using this method, but it does not seem to be working.

        SUEntitiesGetNumEdges(entities, false, &edgeCount);

	std::vector<SUEdgeRef> edges(edgeCount);
	SUEntitiesGetEdges(entities, false, edgeCount, &edges[0], &edgeCount);

	for (int i=0; i < edgeCount; i++)
	{
		SUEdgeRef edge = edges[i];
		SUEdgeSetSoft(edge, true);
		SUEdgeSetSmooth(edges[i], true);
	}

In Ruby I was doing it using hidden and it worked perfectly.

group.entities.each do |e|
              if e.is_a? Sketchup::Edge 
                edges << e
              end
            end # group.entities.each

            # loop through the edges array and hide each edge
            edges.each do |f|
                f.hidden = true
            end # edges.each

#2

How can I use this?

SULoopInputEdgeSetHidden(SULoopInputRef loop_input,
                                   size_t edge_index,
                                   bool hidden);

#3

I see in your snippet that you are using SUEdgeSetSoft and SUEdgeSetSmooth - are these working as expected? Do you see the Soft and Smooth property being set?

To use entities you need to use SUDrawingElementSetHidden - since this property is defined on the DrawingElement class.

In the C API you need to cast the SUEdgeRef into a SUDrawingElementRef to call these methods.

SULoopInputEdgeSetHidden is for SUInputGeometry - creating new entities.


#4

No I don’t think they are working.
How do you cast the SUEdgeRef into a SUDrawingElementRef?
I found how you can do it with an Enitity: SUDrawingElementFromEntity


#5

Nevermind I found it!


#7

Do you have a complete snippet that creates a SKP model that demonstrate your issue with the soft and smooth?