Hi , Jolran
Patterned Model Data-edges and faces , the users have to create and draw by SU.
I agree with you now. This idea is complicated to do.
And when I read you idea , I can picture about it. Thus , I try to test for a square face I want the width to be transom(horizontal) , and the height to be mullion(vertical). That I can load the each type of components on face.bounds.
I did a code from your suggestions by steps.
1. Find face.bounds dimensions - Width and Height
2. Conditions before doing load component
3. Rotate origin Axis at the start position
4. Scaling length
I'm not sure how to compare in conditions
for loading components around a face.I have a basic of programming.I have been trying to load " Face.load_comp " in a ruby console but it has an error.
Thanks for recommending about WYSIWYG editor , I will gradually look about it. I use a free code editor of NotePad ++.
TYPE IN A CONSOLE
Face.load_comp
require 'sketchup.rb'
module Face
def self.load_comp
$stdout.write("START-FUNC; Face.load_comp();\n")
mod = Sketchup.active_model
sel = mod.selection
ents = mod.active_entities
# Grab all the selected faces.
faces = sel.each{|e| e.typename=='Face'}
if faces == 0;
UI.messagebox("Must select at least one face!")
return
end
$stdout.write(" FOR-EACH(face);\n")
faces.each do |face|
$stdout.write(" #{face}\n")
face = face.bounds
puts "Transom = #{face.width.inspect}"
puts "Mullion = #{face.depth.inspect}"
end
#=begin
if puts "Transom = #{face.width.inspect}" # for the width , top and buttom
path = Sketchup.find_support_file "CurtainWall_Architect/Components/00_No_Cap/C-50/Transom/T50X193.2_No-Cap.skp", "Plugins"
#path = File.join(File.dirname(__FILE__), "CurtainWall_Architect/Components/00_No_Cap/C-50/Mullion/T50X193.2_No-Cap.skp") #No need to dig into C;
mydefinition = Sketchup.active_model.definitions.load(path)
gp = Sketchup.active_model.entities.add_group() # Container group. Not a must..
#tr = Geom;;Transformation.new(ORIGIN, user_face.normal) #face selected by user
inst = gp.entities.add_instance(mydefinition, tr)
scalefactorW = face.bounds.width/inst.bounds.width #(simplified, needs some laboring)
tr = Geom;;Transformation.new(ORIGIN,face.normal) #face selected by user
tr = tr*Geom;;Transformation.rotation(ORIGIN, X_AXIS, self.xrotation)
position = entity.transformation.to_a
pt = edge.start.position
tr = Geom;;Transformation.scaling pt, 1.0, 1.0, xscale
entity.transform!( tr )
# invalidate the view to see the move action
#Sketchup.active_model.active_view.invalidate
inst.invalidate_bounds
else puts "Mullion = #{face.depth.inspect}"# for the height of left and right sides
path = Sketchup.find_support_file "CurtainWall_Architect/Components/00_No_Cap/C-50/Mullion/M50X230.5_No-Cap.skp", "Plugins"
#path = File.join(File.dirname(__FILE__), "CurtainWall_Architect/Components/00_No_Cap/C-50/Mullion/M50X230.5_No-Cap.skp") #No need to dig into C;
mydefinition = Sketchup.active_model.definitions.load(path)
gp = Sketchup.active_model.entities.add_group() # Container group. Not a must..
#tr = Geom;;Transformation.new(ORIGIN, user_face.normal) #face selected by user
inst = gp.entities.add_instance(mydefinition, tr)
scalefactorD = face.bounds.depth/inst.bounds.depth #(simplified, needs some laboring)
tr = Geom;;Transformation.new(ORIGIN,face.normal) #face selected by user
tr = tr*Geom;;Transformation.rotation(ORIGIN, Z_AXIS, self.zrotation)
position = entity.transformation.to_a
pt = edge.start.position
tr = Geom;;Transformation.scaling pt, 1.0, 1.0, zscale
entity.transform!( tr )
# invalidate the view to see the move action
# Sketchup.active_model.active_view.invalidate
inst.invalidate_bounds
end
return Geom;;Transformation.new(tr)
#=end
$stdout.write("END-FUNC; load_comp\n")
end # def
end # module