Polygon Positioning Tool
-
Just an FYI, the posted code's improper indentation is so annoying I will not bother to read nor try it out.
-
I agree, the indentation is killing me. Trust me it doesn't actually look like this, when I cut and past it into the text box it completely mucks it up.
-
@medeek said:
I've got the polygon positioning tool mostly worked out for my foundation plugin. However, when the user enters in a value for the length of the segment (VCB_VALUE) then the subsequent line selection does not properly infer the X and Y axis.
There are two problems as I see it.
-
You are using @ip1 and @ip to set the line color but, when you enter a length, @ip1 is no longer valid since the point it represents has changed. I think you should use the last to values of the @pts array to set the color.
-
Expecting the user to get within 0.0001 of the first point to close is way to restrictive.
-
-
I replace the set color line with:
view.set_color_from_line(@pts[@lastpointcount], @pts[@pointcount])
however the behavior is identical.
I agree the .0001 is probably too restrictive. What I should probably do is insert a temporary guide point (add_cpoint) and then delete it once I jump back to my main program out of the tool or as the tool terminates. This way the user has something to snap to in order to close out the polygon.
-
@medeek said:
I replace the set color line with:
view.set_color_from_line(@pts[@lastpointcount], @pts[@pointcount])
however the behavior is identical.
I too find it odd that entering a length suddenly causes the axis inference to change its' behavior. The tooltip seems to think that @ip1 is still valid while, if you zoom in and move the mouse very slowly, the correct inference will occur. After that everything is back to normal until the next length entry.
Very strange indeed and an obvious bug in Sketchup.
-
Yes it is strange. If you enter a value then the next line won't infer the axis, but if you then click the mouse and begin another line the inference returns to normal. The whole tool thing is still somewhat of a black box to me so I don't really understand it fully but this certainly has me confounded.
-
Nat, use 2 space characters for indents. Tabs will not come out well in the forum code blocks.
-
I've been using tabs for indents since 1999, getting me to change now is not easy. You can probably tell that I like a lot of whitespace in my code, easier to read.
-
That is okay (whitespace). I use Notepad++ which automatically replaces TAB with spaces. Each language can have a different indent spacing. (I'd think most editors can [or should] do this.)
-
I totally agree. I use Notepad++ as well and I do not use tabs.
The main reason is everyone can set their tabs differently - but spaces are spaces so the reader gets to see what you want them to see.
-
I tried Notepad++ a couple years ago but something about it perturbed me so I went back to my basic Windows Notepad, I may revisit it.
-
@medeek said:
... so I went back to my basic Windows Notepad, ...
How do you know what encoding it saves the file it ?
How do you know what type of line ending characters it uses ?These are things easily set with a real code editor.
In addition code editors use color lexing to help you spell keywords correctly, match up the begins and ends of code blocks, etc. They also can use autocomplete features to help fillout method calls.
Advertisement