Yeah, that worked, and not having to explode my group fixed a lot of problems. Thank you!
Posts made by lothcat
-
RE: Deleting group.copy?
-
RE: Deleting group.copy?
That may just work. And I figured out why I can't erase the group.copy - because I exploded it. Sometimes I feel dumb.
-
RE: Deleting group.copy?
@thomthom said:
What do you mean by this? "Look at the faces"? I'm wondering why you are making seemingly temp groups to inspect something.
I have attributes attached to the faces that I need to read, but I also have attributes attached to the group. If I don't explode the group, I can't get to the attributes in the face, but if I do explode the group, I lose the group attributes.
Probably not the best way to do it, but it works.
And thank you for the help!
-
Deleting group.copy?
I am having a hard time figuring out how to delete a group. I'm making a copy of a group to explode it and look at the faces, because I want to keep the original group intact, and then when I'm done with the copy, I want to get rid of it.
Here's my code:
if entity.typename == "Group" #UI.messagebox "Group!" copy_group = entity.copy status = copy_group.explode facecounter(status)
I tried using entities.erase_entities copy_group where entities = Sketchup.active_model.active_entities, but that didn't work, so now I'm wondering if there's a better way.
-
RE: Weirdest loading bug ever?
Thank you so much! It's working now and I'm not having that weird loading bug!
Also, thank you for being patient with me. This was a real learning experience.
-
RE: Weirdest loading bug ever?
I'm still using seven because I want to make sure that everyone in the company can use it, but if I have to force people to upgrade, so be it.
Turning off the RELDIR/ABSDIR calls seems to fix it for now.
-
RE: Weirdest loading bug ever?
You're right, I'm leaning on you a lot - it's because you're introducing a ton of stuff here that I've never used, and I wasn't even sure where to begin debugging. I'm still new to this.
I tried modifying your code to my module, but when it didn't work, I tried making the snippets exactly how you wrote them.
I'm putting the ext file in the plugin folder, and the others under lothcat/widget, then starting up sketchup rather than using load. The error is what appears on startup. I thought maybe it was loading the files in the @@plugin statement, so I moved that further down... and that didn't work either.
I can fiddle with it on my own for a while to try to find the problem.
Thank you so much for your help!
-
RE: Weirdest loading bug ever?
I'm trying to use this loader, but I keep getting errors. Specifically:
Error Loading File F:/Program Files (x86)/Google/Google SketchUp 7/Plugins/lothcat/widget/widget.rb
uninitialized constant Lothcat::Widget::RBSFILEError Loading File F:/Program Files (x86)/Google/Google SketchUp 7/Plugins/lothcat/widget/widget_loader.rb
uninitialized constant Lothcat::Widget::RBSFILEError Loading File lothcat_widget_ext.rb
uninitialized constant Lothcat::Widget::RBSFILEWhen I changed the names, I still get an uninitialized constant error.
-
RE: Weirdest loading bug ever?
Thanks for all your help! But I'm not sure I understand - is it better to have the loading script inside the widget folder instead of the plugin folder?
My current loading script is inside the plugin folder, and goes something like this:
Sketchup.load('LothCatWidget/widget') WIDGET_tool = WIDGETmaker.new plugins = "LothCatWidget/" imgdir = plugins # create toolbar tb = UI;;Toolbar.new("LothCatWidget Toolbar") # Button 1 cmd = UI;;Command.new("Widget") { Sketchup.active_model.select_tool WIDGET_tool } cmd.large_icon = cmd.small_icon = File.join(imgdir, "WIDGET.png") cmd.status_bar_text = cmd.tooltip = "Widget" tb.add_item cmd
Would it be better to have this script inside the folder? Do I need to separate out the 'load' command from the toolbar script? And are you saying that it's the fact that I'm using Sketchup.load instead of Sketchup.require that's causing my weird bug?
-
Weirdest loading bug ever?
This is such a strange issue, I don't even know how to describe it properly.
I am developing a plugin for distribution, and therefore I am using scrambled files. I do most of my coding/debugging with the unscrambled files and only load the scrambled files to make sure they work before I send them to my boss. We're just now entering the testing phase.
I only noticed I had an issue when I realized one of my messageboxes was wrong while I was using the scrambled files. It was a silly bug - it had a blank where it needed a dropdown. I fixed it, scrambled it, restarted sketchup - and the blank was still there. So I reworked that messagebox and reordered the inputs, scrambled, reloaded - and it was still the same (wrong) messagebox from before. When I loaded the unscrambled version, the messagebox was fixed, but as soon as I tried to load a scrambled version it was wrong again.
I thought it might be the scrambler, that maybe it was just outputting the wrong file, but when I added or removed comments the scrambled file changed size. I thought it might be a caching issue, so I shut down my computer - but it was still there the next day.
So then, on a whim, I renamed the folder I was loading the plugin from. The images were gone, but my plugin still popped up and worked! The wrong messagebox version, of course.
I was able to load my plugin on a borrowed laptop just to make sure the scrambled files are actually correct, but now I'm worried that I'll be giving out new versions to my testers and this weird glitch is going to keep the older version there, especially since this glitch has appeared on my boss's computer as well.
I am completely flabbergasted, I have no idea how this is even possible. I am using Sketchup.load(extension_name) and Sketchup version 7 running on Windows 7, and my boss has Sketchup 7 running on Windows XP.
Has anybody else had this issue? Is there some sort of unload or reload command that I need to include to make sure Sketchup is using the correct files? Is this a known bug they fixed with Sketchup 8? Or am I the only one with this problem?
-
Checking for a group?
This seems like a silly question, but how do I check if something is a group? I simply can't figure it out.
The user will click to run a function, and I need to make sure that what they clicked on is a group so the function can run properly. I've looked through the API but it was as useless as ever.
-
How to find a group?
Hi all,
This is such a simple question that I feel silly asking it, but I simply can't figure it out. I'm writing a plugin, and I want to calculate the volume of an object, and I know sketchup can do that if the object is a group.
Basically, the user right-clicks a selection to run my plugin, and I want to make that selection a group, calculate the volume, and then output it. I know how to get their selection, and I know how to get the volume of a group, but I don't know how to tell if their selection is a group or how to turn it into one if it isn't.
Any help would be appreciated!
-
RE: Trying to retrieve face using ComponentInstance.glued_to
@dan rathbun said:
FYI: There is a missing ) in line 5 of the snippet.
D'oh! Thank you! I was so sure I was using this wrong that I didn't even look for actual coding errors.
-
Trying to retrieve face using ComponentInstance.glued_to
I'm having some trouble. I'm trying to figure out which direction a window on my house is facing. I have the direction saved as an attribute in the face, rather than a group or component. The trouble seems to be with getting that face. I'm trying to use componentinstance.glued_to, but it's throwing a syntax error.
Here's my snippet:
if entity.typename == "ComponentInstance" cell_data.push(entity.definition.name) if(entity.definition.name == "Window _1") wall = entity.glued_to if(wall.get_attribute("hathmore_attributes", "type") == "AGW" cell_data.push(wall.get_attribute("agw_attributes", "direction_facing")) else cell_data.push('-') end end else cell_data.push('-') end
I feel like the problem is staring at me, I just can't seem to find it.
Thank you in advance for whatever you can do to help.
-
RE: Adding attributes help
OK, so, now that I have that figured out, I'd like to know if there's a way to tell if a face is vertical or horizontal. It seems like
face.plane
would do that, but I've found frustratingly little about how plane works.I'm not sure of the board etiquette. Should I post this question as a new topic, or is this OK?
-
RE: Adding attributes help
@tig said:
When you use
set_attribute(...)
it applies it to the specified entity AND it's only attached to that entity [or later copies of it].
Your earlier code attached the attribute to aface
... so when you runmodel.get_attribute(...)
it quite rightly returnsnil
because you haven't attached that attribute to themodel
??
You can attached an attribute to amodel
BUT your code is attaching it to aface
.
You need to find some faces and then iterate through them and useface.get_attribute(...)
on each in turn and get their attributes ???You're right, that was stupid. I have it fixed now. Thanks!
-
RE: Adding attributes help
@kwalkerman said:
in your latest example, you would read the attribute as follows:
face.get_attribute("agw_attributes", "location)
That was crashing my plugin. So I changed it to value1 = model.get_attribute("agw_attributes", "location") - and it's returning a blank.
There is no reason this line of code wouldn't work, right? So my attributes really aren't being applied after all?
-
RE: Adding attributes help
@dan rathbun said:
If you are on Sketchup 8, you should be seeing errors generated in the console.
You DO have the console open when your debugging.. right?Of course I do, but no errors. However, I'm using Sketchup 7, so that might be why.
Thanks for the links! I'll definitely be using the heck out of them.
@dan rathbun said:
The API docs still have errors, and the examples are often incorrect. There are many methods that do not return what the docs say they do. You should always check the bottom of each API doc webpage to see if one of us has posted a correction.
Believe me, I've noticed. Extremely frustrating. Stuff like that makes me want to give up programming and raise llamas for a living.
The corrections have been very helpful, though.