Sub-component creation, decoration, etc?
-
It will splat if you try to move entities into the entities of a definition and they are cross-threaded to another entity set.
Somodel.active_entities.add_group(face)
will crash because the face's edges are still in the model !!!
face=[face]+[face.all_connected]
model.active_entities.add_group(face_connected)
shouldn't fail as nothing will be left behind...
However, you probably don't want all of the connected bits AND the safe way is to 'clone' it.pts=[];face.vertices.each{|v|pts<<v.position} mat=face.material bac=face.back_material lay=face.layer attrdicts=face.attribute_dictionaries ### grp.model.active_entities.add_group() face_clone=grp.entities.add_face(pts) ### OK if know it's first and so it's the one and only face ? ### if there might be more that one face made by this first make an array of the grp's faces ### and after adding face_clone repeat array and the difference is the faces - then loop through each as set out below... face_clone.material=mat face_clone.back_material=bac face_clone.layer=lay attrdicts.each{|attrdict| name=attrdict.name attrdict.each_pair{|key,value|face_clone.set_attribute(name,key,value)} }if attrdicts ### etc - this doesn't copy the face's edges' attributes/layers/materials, but you get the idea... face.erase! ### 'face' has been cloned into the group, leaving its edges behind. It looks like it's 'moved'. If you had any variables pointing at face that are still used then add face=face_clone ###
-
The one that caught me for a while is if you add an edge, but it is part of a curve, and you are not adding the rest of the edges in the curve - that will splat.
So exploding curves is necessary too.
Chris
-
@chris fullmer said:
The one that caught me for a while is if you add an edge, but it is part of a curve, and you are not adding the rest of the edges in the curve - that will splat.
So exploding curves is necessary too.
Chris
From what I understood of TIG, even exploding the curve and adding one segment will crash, as the edge is still connected to other edges on either side.
Or did I misunderstand? -
@thomthom said:
@chris fullmer said:
The one that caught me for a while is if you add an edge, but it is part of a curve, and you are not adding the rest of the edges in the curve - that will splat.
So exploding curves is necessary too.
ChrisFrom what I understood of TIG, even exploding the curve and adding one segment will crash, as the edge is still connected to other edges on either side.
Or did I misunderstand?No - moving a loose Edge [that is neither part of a Curve or defining a Face] into a Group shouldn't splat... It's the splitting of thing that rely on each other that splats - an Edge might be connected to another Edge at it's end, BUT it shouldn't splat as each can survive without the other - A Curve or a Face need other things [Edges] to define them so moving them 'trans-entities' could be fatal !
-
Gotcha!
-
And there is a feautre request submitted and I heard they are seriously thinking about trying to fix all of this for us.
I often find it would be nice to move existing entities into existing groups.
Chris
-
@chris fullmer said:
And there is a feautre request submitted and I heard they are seriously thinking about trying to fix all of this for us.
I often find it would be nice to move existing entities into existing groups.
Chris
Feature request? Surely it's a bug report? They already added the API for it, with the arguments for add_group, but it's bugged.
-
heh! you're right. I filed it as a bug report (with an ill-advised threat to to do bodily harm to whoever did not get it implemented).
Hopefully they fix it. It would be nice.
Chris
-
Also, I think it is not as bad as you are pointing to TIG. If I add a face without its edges, it works just fine.
---tested more and came back---
hmm, just adding a face that is bound by an edge that is part of a curve ALSO does not necessarily cause a splat like I had thought.
But I do know that in my faces to components script, I ran into problems and when I first exploded all curves in the model, I was able to overcome the splats.
But now I'm confused again as to what causes it.
Chris
-
Sounds like it's one of them fun SmartBugs. Genetically manipulated to be invisible when you look directly at it.
-
Chris
I have also tried it afresh - hadn't tried it recently as who needs bugsplats! I can't get it to splat either
has something been fixed in v7.1[M1] and they're just not telling us ?
It didn't always splat before, BUT trans-entities selections seem to be a major contributor.
One thing it does do, which I sure it didn't used to, is if you draw a cube and select just the one face [no edges] and run the code below it groups the face and replicates its edges leaving the original edges behind but the face has been cut from the model: BUT if you erase one of the cube's faces and then select an adjacent face [again no edges] and run the code the face is cut from the model and so is its edge that had no other attachments, however, the common edges with the other faces are just replicated in the group and remain intact so their other faces are kept... I'm sure it never did that before !group=Sketchup.active_model.active_entities.add_group(Sketchup.active_model.selection.to_a)
In passing I also noticed that running a group intensive script with the Outliner open doesn't seem to splat now ? Again I avoid it but did do it accidentally yesterday a couple of times and no splats... mysterious...
-
Yea - I miss a bug-fix list in the release notes.
Gotto test this with older SU versions though.
Advertisement