I have errors showing up in lines 39 and 67 saying this…
Error: #<SyntaxError: /Users/caydenwilson/Library/Application Support/SketchUp 2019/SketchUp/Plugins/extension.rb:39: trailing `_’ in number
model.active_layer=1_new
^
/Users/caydenwilson/Library/Application Support/SketchUp 2019/SketchUp/Plugins/extension.rb:39: syntax error, unexpected tIDENTIFIER, expecting keyword_end
model.active_layer=1_new
^~~
/Users/caydenwilson/Library/Application Support/SketchUp 2019/SketchUp/Plugins/extension.rb:67: syntax error, unexpected end-of-input, expecting keyword_end>
My code:
model=Sketchup.active_model
selection=Sketchup.active_model.selection
entities=Sketchup.active_model.entities
materials=Sketchup.active_model.materials
layer_array=Sketchup.active_model.layers
require "sketchup.rb"
#Adding extension to menu
cmd=UI::Command.new("ProTrim") {
selection=Sketchup.active_model.selection
selection.each do |e|
end
}
#Validation to check for Edge
cmd.set_validation_proc {
selection=Sketchup.active_model.selection
ok=selection.find{ |e| e.typename=="Edge"}
ok ? MF_ENABLED : MF_GRAYED
}
#Context menu
UI.add_context_menu_handler do |menu|
menu.add_separator
menu.add_item cmd
end
#Input boxes in UI menu which gather measurements for trim
prompts=["Trim Height", "Trim Thickness:", "Quarter Round:", "R:", "G:", "B:"]
defaults=[5.0,0.5,"No",255.0,255.0,255.0]
list=["","","Yes|No","","",""]
input=UI.inputbox prompts, defaults, list, "Stair Info"
height,thickness,quarter_round=input
if quarter_round=='Yes'
quarter_round_width=0.75
quarter_round_height=0.75
notification=UI::Notification.new(sketchup_extension, "Select the trim path.")
notification.show
def build_trim
new_layer=model.layers.add "Trim"
model.active_layer=1_new
name=trim
visable=True
#creating points for the new face
#pts[number]=[width,depth,height]
pts=[]
pts[0]=[0,0,0]
pts[1]=[0,0,height]
pts[2]=[width,0,0]
pts[3]=[width,0,height]
#Creating the trim material
trim=Sketchup.active_model.materials.add"Interior Trim"
trim.color=['R','G','B']
trim_group.material=trim
#Creating a face with the array
face=entities.add_face(pts)
connected=face.all_connected
face.material=new_material
#Checking if selection is an edge
def check_false
selection=Sketchup.active_model.selection
ok=selection.find{|e| e.typename=="Edge"}
ok ? MF_ENABLED : MF_GRAYED
end
path=selection
face.followme path
end
Any and all help is appreciated.
Thanks!