To be honest I steer clear of DCs when I can. Only reason I saw the issue was because this is a type of Euler vs Quaternion rotation issue.
Your model actually prompted me to look into DCs more to see if they had a formula for it. I'm pretty sure you can use a mixture of maths functions to calculate this but it beyond my feeble brain... đ
I created a door in dynamic component. I manage to set the dimensions but on the other hand I cannot "block" the miter cuts of the lintel, in fact each time I change the dimensions, the cuts no longer join.
I attach to this post the file in question.
Does someone want to do the manipulation and repost the file because I dry completely?
Changing the dimension of a component with Dynamic Components is a scaling operation. If you scale a mitered component, the angle and length of the miter will change proportionately with the change in overall length.
Screenshot - 5_17_2021 , 7_14_42 AM.png
To prevent the miter angles from changing, divide the component into three separate components. One for each of the miters and one for the center section. Then you can move one of the miter components and scale only the center section.
Screenshot - 5_17_2021 , 7_18_09 AM.png
Hi Aleja!
I'm afraid you can only set ONE axis origin for each component. BUT with DCs you can move the geometry inside the component and make it rotate the way you want.
Hello
Thank you for this code which opens up nice perspectives for me, especially if I manage to debug the following situation!
Sketchup does not offer the function to count the number of occurrences of a text string in a text.
I have checked in the ruby window the following code and I get the expected result
string = 'hello world'
string.count('l')
# This returns the integer 3
I want to implement a new function but I have the following error
[wrong number of arguments (given 1, expected 2)]
Here is my code that I added after the one from TIG
# add_DC_function.rb
# extends DCs functions
require('sketchup')
require('su_dynamiccomponents.rb')
if defined?($dc_observers)
# Open SketchUp's Dynamic Component Functions (V1) class.
# BUT only if DC extension is active...
class DCFunctionsV1
protected
# DC Function Usage; =volume()
# returns the instance's volume [cu"]
if not DCFunctionsV1.method_defined?(;volume)
def volume(a)
return @source_entity.volume
end
end
# DC Function Usage; =occurence(texte,texte recherche)
# returns the number of the occurency of the string
if not DCFunctionsV1.method_defined?(;occurence)
def occurence(a, b)
return a.count(b)
end
end
end#class
end#if
It should be in View>Toolbars. What version of SketchUp are you using? You're profile says you are using 2016. If you are using a newer version you may need to turn on the Dynamic Components in the Extension Manager first.
Make sure Dynamic Components are Enabled in the Extension Manager. Then you should be able to find the toolbar in View>Tool Palettes. If you need to enable it click Apply Changes then quit and restart SketchUp to make sure it loads.
Hope there is some extension coming soon to solve this issue.
I fear you will be waiting a long time for this! Apart from making the DC Component Attribute panel a bit easier on the eye you will always have to somehow program each element of the DC to do what you want it to do. As the designer (of the DC) only you know how the parts should interact.
AutoCad and Revit were mentioned earlier in the thread. It's probably ten years since I used either of those but do recall that Revit 'Families' (equivalent of DCs) were far more difficult to build than Sketchup DCs but they used a similar syntax/language and method to provide the instructions for making them work. In AutoCad I used Dynamic Blocks which provided constraints but, again, the input required was akin to what you would use in SU DCs. I'm relying on memory to comment here and have not used the Parametric version of AutoCad, maybe there is now something better than I remember!
Rather than a plugin to directly replace the DC Attribute interface, perhaps some form of graphic based workflow would help. Something in Excel maybe? Design the DC logic on another platform before tying your DC in knots within SU!
-Maybe I didn't explain well myself. The tools that I miss from AutoCAD are the ones from the Parametric tab. It allows you to pick a line and set it to be paralell to another one, or just set a rigid dimension on an object that won't change when moved. They seem to be quite intuitive to me, I used to use them a lot. When you mentioned Excel I remember binding a sheet to an AutoCAD drawing in order to change an objects dimensions, that was quite interesting too. I cannot say much about Revit families since I didn't work so much with them, I tried to make a hinge door and it took me long time, it seemed more complicated to me than Sketchup.
Thanks for your time Shawb !
All the solutions that we have come across redraw the SU model in another program. I really thought that with the on-line version they would have come up with something sooner. I can't believe this was 7 years ago. It must be complicated with a major stumbling block otherwise one of the DC guys would be on it like a shot, a big market in my eyes. Good luck with your models.
Select the DC in the Component tray and then right mouse click and select properties. That will let you go for the 'Glue to' and the 'Cut Opening'. I tried this on your DC just now and and you will need to open the DC for editing, select all the sub-components and move them down to the Z=0 position for the vertical 'glue to' to work. At present the back of the whole component will stick to the outside wall face. (try it first after setting the 'glue to'. Also, to cut the outer wall face create a rectangular face (inside the DC) level with the outer wall face. Delete this face to leave just the bounding lines. Do not group these, they form the cutting element. Exit the DC and bring in a fresh DC from the tray - this should now give you the one face opening cut.
Attached modified DC to pick at. I have an updated window to add to my own post shortly.
It looks like it's a complex Dynamic Component [DC] using 'onClick' methods to increase its size.
First learn about DCs, and get as many examples as you can - there are many on the web...
Then experiment...
PS: You posted in the wrong forum... I'll relocate it...
Further to this, you will notice that on animation of the bottom drawer, all move. To correct this the animation must be moved to inside the copy. Hence another level is created.
My reason to ask about your interest in DCs is to guide you in your development. Although internal copies has its merit it also has many drawbacks, in that it greatly increases file size and becomes more complicated in structure, as are becoming aware. So if this is a basic project then okay, but if its a development toward a kitchen design system with quantity lists, materials... then I suggest looking at https://sketchucation.com/plugin/1613-gkware_cabmaker
If you still wish to pursue your own, then I can help, but the DCs need to be simple and have the ability to swap, plus incorporate some simple ruby scripts to make it easier to handle.
I do not have any programming skills jet. So it will probably take me a while to understand your replay fully.
But just a thought tough.
Do you think its possible to change the script from âcutlist 4.1â that it would add the âDefinitionâ of the DC component to its subcomponentâs âdefinitionâ?
That way I wouldnât have to change any of my dc and the way I name them.
After yet another go at this I found the following. The Component Options and Component Attributes panels can be opened at any point in a modelling session including after selecting/deselecting existing components (not necessarily dynamic components) or creating new components. However, the Options panel must be opened first. Any component selected will now show up in the Options panel. Before the Attributes panel can be launched a component (any) must be selected. Once the Attribute panel is launched the selected component can be deselected without any inputs to either panel. Thereafter, components can be selected, attributes added etc. Both panels will work as expected. Both panels can be dismissed if not needed further but to relaunch them the same sequence must be observed.
Maybe this behaviour is a quirk of just my own setup but the procedure that I found (stumbled across) is certainly not in any way an explanation.
check my examples and my corresponding questions to them
the house dc... > how can i protect the "hidden" geometry necessary for it to funktion? i use plugins like ccleaner alot .. some option to protect stuff inside dcs would be welcome đ
the skylights.. how can i add a secondary rotation function for the wing? and how to switch between the or cycle through them?
the door... works as expected but when placing them i flip and scalethem with -1 alot.. then things start to "brake"
im trying to get my head around this stuff .. simple things can be done quick and easy but once 2-3 parameters and "constraints" are introduced dcs are kind of messed up đ
i hope someone has the time and patience to guide me along a bit...