A big thank you. This plugin will be saving me hours and hours of work!
Latest posts made by meeta
-
RE: [Plugin][$] FredoScale - v3.6a - 01 Apr 24
-
RE: How to apply attributes through code? and how do they work?
if (Sketchup.active_model.selection[0].typename == "Group" or Sketchup.active_model.selection[0].typename == "ComponentDefinition") menu.add_separator menu.add_item("Beam Analyser") { b = Beam.new b.bbox b.prompts . . . . . . def bbox @beam = Sketchup.active_model.selection[0] bbox = @beam.bounds point1 = bbox.max point2 = bbox.min b = (point1[0] - point2[0]).abs.to_mm.to_i length = (point1[1] - point2[1]).abs.to_mm.to_i h = (point1[2] - point2[2]).abs.to_mm.to_i end
does this make it more clear? If I choose a group, there is not problem. But if I choose a componentinstance, The attributes are applied without any problems. Unfortunately its not being applied to @beam.
-
RE: How to apply attributes through code? and how do they work?
what exactly is a component definition?
-
RE: How to apply attributes through code? and how do they work?
@beam = Sketchup.active_model.selection[0] bbox = @beam.bounds point1 = bbox.max point2 = bbox.min b = (point1[0] - point2[0]).abs.to_mm.to_i length = (point1[1] - point2[1]).abs.to_mm.to_i h = (point1[2] - point2[2]).abs.to_mm.to_i @beam.set_attribute "Beam Information", "1. Type of Concrete", "#{@cstrength}"
Ok one problem now, I have selected active_model as either ComponentInstance or Group. When its a group I can apply the attributes with no problem! But when its a component I am not able to add the information. Is there a way I can add all this information to it? and Is there a way to apply the same attributes to all the ComponentInstances in the active_model?
-
RE: How to apply attributes through code? and how do they work?
Ahh there is my mistake! I love finding mistakes..
I thought group is a method and not a variable!
-
RE: How to apply attributes through code? and how do they work?
here is the code i think its fine..
def draw_beam model = Sketchup.active_model entities = model.entities group = entities.add_group entities = group.entities pt = [] pt[0] = [0, 0, 0] pt[1] = [@b, 0, 0] pt[2] = [@b, 0, @h] pt[3] = [0, 0, @h] c_section = entities.add_face pt @length = -@length if( c_section.normal.dot(Y_AXIS) < 0 ) c_section.pushpull @length entity1 = entities[1] status = entity1.set_attribute "Dimensions", "Length", "#{@h} mm" status = entity1.set_attribute "Dimensions", "Width", "#{@b} mm" status = entity1.set_attribute "Dimensions", "Effective Length", "#{@d} mm" end
-
RE: How to apply attributes through code? and how do they work?
I think the different entities are stored in an array format right? I copied the exact thing from the Google API.
[url]
http://code.google.com/apis/sketchup/docs/ourdoc/entity.html#set_attribute[/url] -
RE: How to apply attributes through code? and how do they work?
Yes it all goes well without any errors to debug. But When I right-click and click 'Show Attributes' there is nothing there but this in the dialog box:::
%(#8080FF)[**Add Category...
You can create/delete categories of Attributes and add/edit and delete individual attributes within a category.
To get started, click on the Add Category... link above.Tip: You can create standard categories by clicking here.
Add an attribute Delete Category Cancel Accept**]
Is there another way of access the attributes I applied? And say I save this box, will the attributes be saved too?
-
RE: How to apply attributes through code? and how do they work?
I am sorry about that, With so many plugins installed, I lost track of what is really sketchup and what is the plugin. Let me rephrase:::
Say I create a box, with the help of a plugin and group it. I want to be able to see information about the group, by selecting 'Show attributes'. But I want the attributes to be made automatic. i.e. I want see, that it is a box, it has height h, width w, etc. How can I do this?
-
How to apply attributes through code? and how do they work?
entity1 = entities[0] status = entity1.set_attribute "Dimensions", "Length", "#{@h} mm" status = entity1.set_attribute "Dimensions", "Width", "#{@b} mm" status = entity1.set_attribute "Dimensions", "Effective Length", "#{@d} mm"
Hi I have an entity which is a beam. It has the dimensions @h, @b and @d. How Can I make it appear onto my group when I right-click and click show attributes.
I don't have pro, but I use at the university. does having the free version have anything to do with why its not working?