Undefined method error

G

Greg Frazier

Hello,

I am encountering the following runtime error:

load('C:\\SketchUp\gfVirtualWMS.rb')
Error: #<NoMethodError: C:/Program Files/Google/Google SketchUp
6/Plugins/gfMakePallet01.rb:59:in `gfMakePallet01': undefined method
`material=' for nil:NilClass>
C:/Program Files/Google/Google SketchUp 6/Plugins/gfMakePallet01.rb:59

The code snippet is as follows:

require 'sketchup'

def gfMakePallet01 (x,y,z,w,l,h,theColor,itemNo,lotNo,qoh,expDate)

model = Sketchup.active_model

value = model.set_attribute "link_data", "url", 115
attrdicts = model.attribute_dictionaries
attrdict = attrdicts["link_data"]
dict_name="link_data"
dicts=model.attribute_dictionaries
if( dicts!= nil and dicts[dict_name] )
dict_key_url = model.get_attribute(dict_name, "url")
else
UI.messagebox("No URL set for this ")
end


materials = model.materials
m = materials.add "Joe"
m2 = materials.add "Fred"
#m.texture="c:\\Program Files\\Google\\Google SketchUp
6\\Materials\\Tile\\Tile_Navy.skm"
#m2.texture="c:\\Program Files\\Google\\Google SketchUp
6\\Materials\\Metal\\Metal_Panel.skm"
color = m.color = theColor
#texture = m.texture
#color = texture.average_color
#if (color)
# UI.messagebox color
#else
# UI.messagebox "Failure"
#end

entities = model.entities

edges = []
model.start_operation "Make Pallet"

# left side plane
pt1 = Geom::point3d.new(x,y+l,z)
pt2 = Geom::point3d.new(x,y,z)
pt3 = Geom::point3d.new(x,y,z+h)
pt4 = Geom::point3d.new(x,y+l,z+h)
edges[0] = entities.add_line(pt1, pt2)
edges[1] = entities.add_line(pt2, pt3)
edges[2] = entities.add_line(pt3, pt4)
edges[3] = entities.add_line(pt4, pt1)
face = entities.add_face edges
face.material = m

Thank you for your assistance.

Greg
 
R

Robert Klemme

I am encountering the following runtime error:

load('C:\\SketchUp\gfVirtualWMS.rb')
Error: #<NoMethodError: C:/Program Files/Google/Google SketchUp
6/Plugins/gfMakePallet01.rb:59:in `gfMakePallet01': undefined method
`material=' for nil:NilClass>
C:/Program Files/Google/Google SketchUp 6/Plugins/gfMakePallet01.rb:59

The code snippet is as follows:
Thank you for your assistance.

And your question was?

Kind regards

robert
 
G

Greg Frazier

Robert said:
And your question was?

Kind regards

robert

Robert. I solved the problem. There was a stray method firing off in
the Plugins window when SketchUp launched. Thank you

Greg
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,701
Latest member
XavierQ83

Latest Threads

Top