ok it's good! thx
Just one things, for add keyboard shortcuts, what's is the function?
again thx.
ok it's good! thx
Just one things, for add keyboard shortcuts, what's is the function?
again thx.
Hello,
I have a simply menu, i want create a toolbar of this. What is the function?
thx.
I don't know if your function correspond at my question
Maybe isn't possible, but i have the configuration of my layer like in the screen:
and i want arrive at:
hello,
I work with layer in my plugin.
I create an object, this object must be put on a layer.
I want to be in a specific layer, and not just put visible=false or true.
See in my code after :
#I have 3 layers:"Layer0", "Batiment" and "Gestion de zones", i hide "Batîment"
#I want to be in the layer "Gestion de zone" to create my object
#here "Batiment" is just hidden but i don't arrive to be in the layer "Gestion de zone"
thx.
model=Sketchup.active_model
#I have 3 layers;"Layer0", "Batiment" and "Gestion de zones", i hide "Batîment"
#I want to be in the layer "Gestion de zone" to create my object
#here "Batiment" is just hidden but i don't arrive to be in the layer "Gestion de zone"
layers = model.layers
layers.each { |e|
name=e.name
if name.to_s == "Batiment"
e.visible=false
end
if name.to_s == "Gestion des zones"
e.visible=true
$gestion_zone_activation=1
end
}
# Get "handles" to our model and the Entities collection it contains.
model = Sketchup.active_model
entities = model.entities
# Create a series of "points", each a 3-item array containing x, y, and z.
pt1 = [0, 0, 0]
pt2 = [30, 0, 0]
pt3 = [30, 0, 17]
pt4 = [0, 0, 17]
coordinates = [0, 0, 8.5]
# Call methods on the Entities collection to draw stuff.
# new_face = entities.add_face pt1, pt2, pt3, pt4
group = entities.add_group
point = Geom;;Point3d.new coordinates
group.entities.add_face(pt1,pt2,pt3,pt4)
hum, ok, thx.
When i search on this API i don't find...-_-' you are my angel thx
Hello,
Is it possible to use the add-on gtk for ruby and use this in a plugin sketchup?
I want to create a listbox.
Maybe i can create a listbox less gtk in my plugin but say me if you know^_^.
Thx -_-'
menu.add_item("Delete a Friend(" + namef=Sketchup.active_model.selection[0].get_attribute("MyDico", namefriends).to_s + ")") { delete_friend(namefriends)}
I want to pass the attribute corresponding, after in my function:
def delete_friend(name)
puts name
a=Sketchup.active_model.selection[0].set_attribute("MyDico",name,nil)
end
the problem, if i have for my object the attributes: name="Pauline"; namefriends1="Jim"; namefriends2="John" ect ect namefriends+i="a name" (pauline it's a person and Jim, john ect ect are friends, if i want delete a friend of the list i must say "namefriends corresponding to the friend is nil".)
in skectchup i have my menu with a list of: Delete a friend(Jim)
Delete a friend(john)
Delete a friend(anna)
when i click on one menu the namefriends is always anna because it's namefriends+i.to_s and so namefriends3 for all menu...
ok thx, i test your solution. I don't know what I'll do without you...really...
Pauline, you want NameF to contain a user friendly name - but instead you're getting something else? What value is it NameF is getting?
NameF contained Just a person, and this person have a lot of friends (NameFriend)
I created a function that associates an object to other objects. Each object is a person.
So a person(NameF) conatained friends ("NameFriend"+i.to_s)
Exemple: Jim (NameF) contained too Adrian(NameFriend1),Jaine(NameFriend2),Sylvain(NameFriend3)
My menu is a list to delete a friend. I want to pass the NameFriend corresponding in the function "delete_friend" to know what a friend I delete.
And in my menu, when i click on my menu, NameFriend is not the good variable, because:
NameFriends="NameFriends"+i.to_s
menu.add_item("Delete a Friend(" + NameF=Sketchup.active_model.selection[0].get_attribute("MyDico", NameFriends).to_s + ")") { delete_friend(NameF)}
When i click on my menu NameF i have always the last NameF where i is max. So...it's good for the last friend but no for other.
An other question? I do not know if I'm clear...
We can use the extension gtk2? i don't test for the moment.
Hello,
I don't find a solution, see in my code after "#####menu of the friend list to delete them", i have explain the problem.
It's an algorithm problem.
Thx.
require 'sketchup.rb'
def delete_friend(NameFriend)
UI.messagebox (NameFriend)
end
#Menu
if (not file_loaded?("zListFriend_config2.rb"))
UI.add_context_menu_handler do |menu|
if (Sketchup.active_model.selection.length == 1)
menu.add_separator
if ((Sketchup.active_model.selection[0].get_attribute("MyDico", "Name")) != nil)
i=0
a="x"
while (a != "" )
NameFriends="NameFriends"+i.to_s
a=Sketchup.active_model.selection[0].get_attribute("MyDico", NameFriends).to_s
if( a !="")
#####menu of the friend list to delete them
#####My problem; i don't arrive to pass the good name in the function "delete_friend", when i click on sketchup.
###i want to pass the name corresponding example; if i have the menu "Delete a Friend (Jim), i want to pass Jim in the function delete_friend.
menu.add_item("Delete a Friend(" + NameF=Sketchup.active_model.selection[0].get_attribute("MyDico", NameFriends).to_s + ")") { delete_friend(NameF)}
###NameF is the good name on the menu title but don't pass the good name in my function
end
i += 1
end
end
end
end
file_loaded("zListFriend_config2.rb")
end
Hello,
I select the objects where the attribute ZoneAdr = ZoneName.
I want after to have a selection of all item to can see them (in my code ### I want to have my objects added to the selection to see them
##??? selection.add e? ).
I see "selection.add entity" but i don't know if it's the good function.
Else i want change the color of my object what is the function?
thx.
def selectbindzone
val = Sketchup.active_model.selection[0].get_attribute("MyDico", "ZoneName")
default = [val]
UI.messagebox (default.to_s )
model=Sketchup.active_model
entities=model.selection.to_a
entities=model.entities.to_a
### an array
#blinds=[]
entities.each{|e|
val2 = e.get_attribute("MyDico", "ZoneAdr")
default2 = [val2]
if default2.to_s==default.to_s
### I want to have my objects added to the selection to see them
##??? selection.add e?
UI.messagebox ("object find")
### it's a string - could be integer ==
#blinds << e
end
}
end
Hum...the context is not easy.
I explain better^^ the API to up or down for example a roller shutter, is a service, like a Windows service.
I have a test ok with some language: c, c++, VB, VBS, C#.
And with my plugin ruby i want create a link with a language, to can use the service.
Example in VBS:
'the service always run, just need to create a new COM
Set Solaris = CreateObject ("VsxComServer.SolarisApp")
set VsxVBus = Solaris.VSXVBus
'Up the blind
VSXVBus.VSXStop 67, zg, zsg, rg, rsg, ft
VSXVBus.VSXWait 100
VSXVBus.VSXUp 67, zg, zsg, 0, rg, rsg, ft
oh, if VBS can run it's good,
but... if i want take a string of my plugin ruby and to pass this string in a VBS, i must open a webdialog, and in my php to use the VBscript with IE? or this is an other solution?
I want to run a electrical motor for a blind for example when i click on an object draw whith sketchup and the COM it's a windows dll, i can use VB, c, c++, c#...but no ruby
So i must with my plugin ruby run a VBS(but i need some information as the motor adress), or to can use c / c++...
Hello,
It's possible to lunch a VBscript with ruby?? or with a dll or API to use VB in a plugin ruby??
thanks.
Pauline
Hello,
In this code i associate an adress and a type for an object.
If i have 10 objects, 4 objects have as adress "9994" (in the dictionnary "MyDico", ZoneAdr="9994"), i want create a plugin to select all object with "9994" as adress.
It's possible?
thx
def setzone
prompt = ["Nom de la zone"]
val = Sketchup.active_model.selection[0].get_attribute("MyDico", "ZoneAdr")
default = [val]
result = UI.inputbox prompt, default, "Enter le nom de la zone"
adrresult = result[0].to_s
adr = Sketchup.active_model.selection[0].set_attribute("MyDico", "ZoneAdr", adrresult.to_s)
UI.messagebox ("@ ; " + adr.to_s + " saved")
adrresult="5"
adr = Sketchup.active_model.selection[0].set_attribute("MyDico", "ZoneType", adrresult.to_i)
end