π‘ LightUp 7.1 | SketchUp's only real-time renderer that uses object-based rendering
Download Trial
Why can not draw the geometric by the ruby script?
-
require 'sketchup.rb' def create_model() @lengthl=100.m if not @length1 @widthl=50.m if not @widthl @number=4 if not @number @blength=10.m if not @blength @bwidth=5.m if not @bwidth @bheight=5.m if not @bheight @spacing=5.m if not @spacing prompts=["Length of Land; ","Width of Land; ","The Number of Building; ","Building Length; ","Building Width; ","Building Height; ","Building Spacing; "]### defaults=[@lengthl,@widthl,@number,@blength,@bwidth,@bheight,@spacing] input=UI.inputbox(prompts,defaults,[],"Create Model") return nil if not input @lengthl,@widthl,@number,@blength,@bwidth,@bheight,@spacing=input amount=@number model=Sketchup.active_model entities=model.active_entities if @blength>@lengthl UI.messagebox('The Building Length is more than Length of Land!') elsif @bwidth>@widthl UI.messagebox('The Building Width is more than Width of Land!') else model.start_operation("Create Model")### for the 'undo' x=0;y=0 ### also don't muddle the width/height !!! amount.times{|i| pt1=[x,y,0]### pt2=[x+@bwidth,y,0]### pt3=[x+@bwidth,y+@blength,0]### pt4=[x,y+@blength,0]### new_face=entities.add_face(pt1,pt2,pt3,pt4) new_face.pushpull(-@bheight) ### pushUpull typo !!! -ve = pull up as the face is reversed... y=y+@blength+@spacing ### set in a line x=x+@bwidth+@spacing if y>@lengthl UI.messagebox('The area of land is inadequate !') if x>@widthl } ### end #if## model.commit_operation ### end#def ### if not file_loaded?("2.rb") ### so only get menu item once... UI.menu("Plugins").add_item("Create Model2"){create_model} ### end#if ### file_loaded("2.rb") ###
I have difficult to the script,help me .Thanks!
-
The ruby script can not run in sketchup 6,but can run in sketchup 7.
-
I'm not sure, it worked for me in both 6 and 7. Are you getting any errors in the ruby console?
Chris
Advertisement