I would like to share wit you "Sketchup to CNC" tutorial by using One Click Cabinet extension
K
Latest posts made by kimdv
-
Sketchup to CNC by using One Click Cabinet extension
-
How to set color for DIMENSION_TEXT
Hello everyone!
I created a Layout document by Ruby from SU, and added SU model to it. Then, I added dimension by using the following command:dim = Layout;;LinearDimension.new(start_2d, end_2d, start_offset_length) doc.add_entity(dim, layer, page) dim.connect(start_point, end_point)
However, the background color and the border stroke of the DIMENSION_TEXT are always "red", as you can see in the attached file. It happened after I connect the ConnectionPoints (by using "dim.connect(start_point, end_point)" above.
How can I set the color of the stoke and background to be "white" or none?
Thank you very much for your help.
-
Wrong distance and position of exploded dynamic component
I am new to Sketchup extension development. Attached file is part of a dynamic component after getting it exploded. Then I applied the following code:
def self.definition(instance) if instance.is_a?(Sketchup;;ComponentInstance) # ComponentInstance return instance.definition elsif instance.is_a?(Sketchup;;Group) if instance.entities.parent.instances.include?(instance) return instance.entities.parent else Sketchup.active_model.definitions.each { |definition| return definition if definition.instances.include?(instance) } end elsif instance.is_a?(Sketchup;;Image) Sketchup.active_model.definitions.each { |definition| return definition if definition.image? && definition.instances.include?(instance) } end return nil # Error. We should never exit here. end mod = Sketchup.active_model # Open model ent = mod.entities # All entities in model sel = mod.selection # Current selection puts ent[0] faces = definition(ent[0]).entities.grep(Sketchup;;Face) puts faces faces[0].material = "Purple" faces[0].vertices.each {|v| puts v.position} puts '---' f0_v = faces[0].vertices for i in 0..f0_v.size - 2 puts f0_v[i].position.distance(f0_v[i+1].position) end puts f0_v[3].position.distance(f0_v[0].position)
The result is not as I am expected:
#<Sketchup;;Group;0x0000024da5ea60b0> #<Sketchup;;Face;0x0000024da5ea5f20> #<Sketchup;;Face;0x0000024da5ea5e30> #<Sketchup;;Face;0x0000024da5ea5d18> #<Sketchup;;Face;0x0000024da5ea5cc8> #<Sketchup;;Face;0x0000024da5ea5c78> #<Sketchup;;Face;0x0000024da5ea5c50> (0 mm, 0 mm, 300 mm) (0 mm, 0 mm, 0 mm) (300 mm, 0 mm, 0 mm) (300 mm, 0 mm, 300 mm) --- 300 mm 300 mm 300 mm 300 mm
Any one can help me?
I am sorry for my bad English.