A big thank you. This plugin will be saving me hours and hours of work!
Posts
-
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?
-
RE: Setting a certain unit as standard
Thank you Thom and Martin.. I understand better now :
-
RE: Setting a certain unit as standard
Because my constants are based on eurocode 3.. Which I definitely cannot change. I have constant such as this 25 kN/mm.. which I cannot avoid..
I reckon.. I will put something like this every time I multiply
h.to_mm*250
-
RE: Setting a certain unit as standard
Best option for me, I reckon ask the user to input in his or her own units and then convert to mm for my calculations..
no offense to anyone.. but s ketchup should've been based on the metric system.. -
RE: Setting a certain unit as standard
so says we ask the user to input this
'number'
this is in inches automatically?
and say i ask the user to input
'number' and then put 'number'.to_mm
does that mean it is converting inches in to mm?
-
Setting a certain unit as standard
I created a small plugin that calculates the reinforcement for concrete beams and columns. I gave it to my friends to show off, but unfortunately, he was using inches and I was using mm and it was quiet the embarrassing moment . Is there a way to set the unit as mm in the start of the program. Is this permitted by sketchup? or is there is way to not convert the units every time?
-
RE: Mathematics related problem
ahh notepad++ old friend.. i used to do my c++ programming on it and then take it to university to test it! haha
i think i am gonna take the night off and start over with this tomorrow might crack something.. good night world! -
RE: Mathematics related problem
haha i see what you mean.. i ought to not touch the irb as well! i just downloaded and installed jim's web console.. its really good.. i dinno i could write and test the code in sketchup! i used to restart and edit it in msft notepad! not anymore.. always love increasing productivity :
-
RE: Mathematics related problem
ohh really? thanks i am newb with sketchup programming have been using sketchup for a few years though.. anyways now i wont look like a fool if anyone says console and i think of the irb! thanks
-
RE: Mathematics related problem
@thomthom said:
You are aware of the Ruby Console window in Sketchup, right? That's the one I'm referring to. That will let you see the values you get from the script running in SU's Ruby.
oh you mean that ruby console,, i thought you were talking of the interactive ruby console.. sorry about them.. let me try it out now!
-
RE: Mathematics related problem
@thomthom said:
@meeta said:
I know that many UI boxes is absolutely silly but that's my way of debugging because I know no other way! pls recommend any other method for debugging!
Output the values to the Ruby Console, use the
puts
method.puts "Hello World"
yes i tried doing that,, but strangely the answer in ruby is always right but not in sketchup! so i figured something must be wrong in the code or in sketchup! hopefully its my code because that'll be easier to fix