@tig said:
The Ruby
__FILE__
won't work inside a compiled .rbs file, so that's probably breaking it.
...
...
Something is not right here - you say the "FILE" won't wotk in .rbs files - NOT TRUE !
Here is an example and it works fine BOTH as rb- and rbs-file:
require 'sketchup'
filename=File.basename(__FILE__)
if(not file_loaded?(filename))
UI.menu("Plugins").add_item("Bolte") { Sketchup.active_model.select_tool Bolte.new }
end
file_loaded(filename)
class Bolte
# Konstanter til diverse dialoger og statustekster
DIAMETER = "Diameter ;"
HOVEDTYP = "Hovedtype ;"
SKIVEVED = "Skive ved ;"
PLACER = "Placer ved ;"
KOPI = "Tilføj kopi ;"
FORFRA = " ELLER højre-klik for at starte forfra !"
NOTONFACE = "Det udprikkede punkt er IKKE på en flade !"
UDAFEMNET = "Angiv boltlængden ved at klikke, hvor hjælpelinien kommer ud af emnet"
EVTFLERE = "Vælg evt. flere boltplaceringer, indtast fast boltlængde"
SEKSKANT = "6 Kant"
UNBRAKO = "Unbrako"
INGEN = "Ingen"
HOVED = "Hoved"
MOETRIK = "Motrik"
BEGGE = "Begge"
UDMAAL = "Krydsstreger"
KLIKMUS = "Klik med mus"
JA = "Ja"
NEJ = "Nej"
def initialize
UI.messagebox("Hertil !",MB_OK)
end
end # of class Bolte
I beleave the code witch started this posting is structured EXACTLY likewise - but it will ONLY run as a rb-file, NOT as a rbs-file - i can't see the principal difference:
require 'sketchup'
filename=File.basename(__FILE__)
if(not file_loaded?(filename))
UI.menu("Plugins").add_item("Remskive") { Sketchup.active_model.select_tool Polley.new }
end
file_loaded(filename)
class Polley
# store bogstaver evt. med _ er en CONST
MINDIAP = 50.mm
MINDIAA = 10.mm
MINKRVD = 25.mm
MINKRVB = 15.mm
def initialize()
UI.messagebox("Hertil !",MB_OK)
end #initialize
end #class
Can someone pleace tell me why ?
Both sample codes are cut down to minimal still showing the problem (you can cut out more if you like) - that's why they seems so non sence !
(>> thomthom: The original files ARE organised as SketchupExtensions - but it's not shown here because I don't think it's part of the problem)