@dhruv said:
How can I load different .skp files to my game from webdialogue?(I want to do this cause I dont want to go every time to drop down menu from plugins and load the map)
Not truly professional I'm sure but this works
#RUBY
@dlg.add_action_callback("load") {|d, p|
a= p.split(",")
subDir ="Components/NamesetComponents/"
fileName = a[0]+".skp"
model = Sketchup.active_model
entities = model.active_entities
theX = Integer(a[1]).mm
theY= Integer(a[2]).mm
theZ = Integer(a[3]).mm
point = Geom;;Point3d.new theX,theY,theZ
txyz = Geom;;Transformation.new point
path = Sketchup.find_support_file fileName, subDir
definitions = model.definitions
componentdefinition = definitions.load path
instance = entities.add_instance componentdefinition, txyz
theDegrees = Integer(a[4]).degrees
theAxis = a[5]
rv = Geom;;Vector3d.new(0,0,1) if theAxis == "z"
rv = Geom;;Vector3d.new(0,1,0) if theAxis == "y"
rv = Geom;;Vector3d.new(1,0,0) if theAxis == "x"
tr = Geom;;Transformation.rotation(Geom;;Point3d.new(instance.bounds.center), rv, theDegrees)
instance.transform! tr }
//JAVASCRIPT
function loadSkpFile(){
param = new Array(theFile,theX,theY,theZ,rz,theAxis)
param = param.join(",")
window.location.href = 'skp;load@'+param }
@dhruv said:
How can I open a web - browser by left clicking on the model? (Something like onclick function from maybe dynamic components)
As I understand it, you can do it with a selection observer, but I haven't figured out the code for that.
Hope this is useful.
Chris