Fill component with lines
-
Hello,
I'm new here although I have been playing around with ruby & vba on and off for a couple of years
I want to be able to "fill" a component with parallel edges so they form a grid. I've managed to write a very basic repeater that can draw a grid of lines and then I can manually drop a component into the box of lines and then intersect all the lines and then cut off all the ends but how can I make the code do the fill without having to go through all of that.
Maybe the code would do all of that or maybe it would be smarter and only put lines where they were required in the first place
Here is what I've written so far, if you set the parameters too high it hangs up
I work in mm with accuracy 0.1mm in the units settings
prompts = ["Scan spacing?", "x axis max?", "y axis max?", "z axis max?"]
defaults = ["0.1", "10", "10", "10"]
list = ["0.1|0.2|0.4","10|20|30","10|20|30","10|20|30"]
input = UI.inputbox prompts, defaults,list, "Set up lines."scan = input[0].to_l
xmin = 0
xmax = input[1].to_l
ymin = 0
ymax = input[2].to_l
zmin = 0
zmax = input[3].to_l
lines = (xmax/scan)
UI.messagebox (lines)
UI.messagebox (scan)while zmin < zmax
while ymin < ymax
pt1 = [xmin,ymin,zmin]
pt2 = [xmax,ymin,zmin]
ymin += scan
Sketchup.active_model.entities.add_line(pt1,pt2)end
ymin = 0
zmin += scan
end?
Any pointers in the write direction would be great.
thanks , Tom
-
Hi Tom,
There is a plugin named Hatchfaces that sounds like it would meet your requirements.
-
Jim,
hatch faces looks to be area only. I am trying to do volume. The script I wrote works to generate the box but how would I perform an intersect & trim extents command in ruby so I'm just left with the volume of the component filled with an array of lines ?
Regards ,
Tom -
I think I'll re visit that area plugin, maybe it can be tweaked.
Advertisement