is there a way using ruby?
i found the code to retrieve the version of sketchup
sketchup_v = Sketchup.version_number.to_s
but i don't see anything to do the same for the model itself
is there a way using ruby?
i found the code to retrieve the version of sketchup
sketchup_v = Sketchup.version_number.to_s
but i don't see anything to do the same for the model itself
@kekec1313 said:
Hi,
I have a complex object imported with a lot of inner geometry, of course as always object is not solid. It tooks 4M memory in file and CPU time to manipulate.
But all I need is only outer dimensions, simplified surfaces, 3D silhouette without all this inner geometry.
I tried solid tools but there is a problem with "not solid". I tried to find all these gaps but it is not so easy. Deleting lines, etc. time consuming.
Is there any plugin to do this job?
Thanks!
maybe this one can help you
http://sketchucation.com/forums/viewtopic.php?t=31908
but you will probably have to explode everything before using it
@unknownuser said:
Hi There,
While trying to load the loxodrome plugin in skp pro 2017 I have this message:
Error Loading File rp_loxodrome.rb
Error: #<SyntaxError: C:/Users/Slim/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/rp_loxodrome.rb:19: invalid multibyte char (UTF-8)Any help to sort out the problem would be greatly appreciated.
Thanks
Sl!m
it is a crypted file (rbs)
no way to fix it, except if you have the source file
This plugin creates a loxodrome (spherical helix, rhumb line) in SketchUp, based on parameters.
(regular-polygon.com)
@unknownuser said:
Hi There,
While trying to load the loxodrome plugin in skp pro 2017 I have this message:
Error Loading File rp_loxodrome.rb
Error: #<SyntaxError: C:/Users/Slim/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/rp_loxodrome.rb:19: invalid multibyte char (UTF-8)Any help to sort out the problem would be greatly appreciated.
Thanks
Sl!m
"invalid multibyte char (UTF-8)"
invalid character, it seems, should be easy to fix if there is no other problem
i have to work to understand what you wrote, observers a re new for me
thank you
@dan rathbun said:
Taking John's example cross-platform:
> class MyModelObserver < Sketchup;;ModelObserver
>
> # ! If the DC extension is ever changed, this example could break !
>
> def onPlaceComponent(instance)
> return nil unless defined?($dc_observers)
> # check if it's a DC in here;
> if instance.attribute_dictionaries &&
> instance.attribute_dictionaries['dynamic_attributes']
> # then set Selection Tool and trigger the dialog;
> Sketchup.active_model.select_tool(nil)
> dc_class = $dc_observers.get_latest_class
> if dc_class.configure_dialog_is_visible
> dc_class.get_configure_dialog.bring_to_front
> else
> dc_class.show_configure_dialog
> end
> dc_class.refresh_configure_dialog
> end
> end
>
> end
>
This code is fragile, because it deals with someone's else's extension. They could change it (such as method names,) at any time in the future and this example will break.
@driven said:
you need an App Observer that starts a Model Observer that contains an Components Observer that checks for Dynamic Attributes so you can then use a Sketchup.send_action)__if one exists...
probably easier to set a shortcut key...
john
i found a way, using autoit
https://www.autoitscript.com/site/
this code:
SendKeepActive("[CLASS;Sketchup Pro 2017]")
; Simulate entering a string of text.
Send("{ALT}")
Sleep(500)
Send("F")
Sleep(500)
Send("{ENTER}")
Sleep(500)
Send("{O}")
can be compiled with Aut2Exe, and then launched from a plugin
@driven said:
you need an App Observer that starts a Model Observer that contains an Components Observer that checks for Dynamic Attributes so you can then use a Sketchup.send_action)__if one exists...
probably easier to set a shortcut key...
john
thank you for trying
there is no component observer, and there is no sketchupsendaction related to dynamic components...at least i have not find any; i did find an Entityobserver, but it doesn't help...
a shortcut key would be fine if it was possible to embed it in a ruby code line
...options dialog box
do you know about any?
when a dynamic component is introduced in a sketchup model, it is autmatically selected
it would save time to automatically open the options dialog box too...
@rv1974 said:
@glro said:
@rv1974 said:
Rather bizarre request..
Why one won't just put any desired desktop shortcut instead?maybe because when sketchup fills your screen entirely, you have to close or reduce the sketchup window to access the shortcut
if the shortcup is inside the sketchup window, you can access it directly
each clic matters...
Just ONE Win+D (Alt+Tab if it's open) hit! And thisrequires a dedicated plugin??
And to pin a File or Folder to the Windows 7 Taskbar won't ease solve your problem either?
the "dedicated plugin" is such an easy one..no big deal
and from what i understand, it is the beginning of something else
i just tried to help
@bep said:
...
I got the script opening a file just as i requested.However the file will pup up in front of the Sketchup-window, and than in a split second hides behind it.
I have to click the file icon on the taskbar or reach for the file-window behind the Sketchup-window, to click it, and to get it in front of the Sketchup-window again.I hope i can figure out how the fix this last bit.
Bep
on my computer, the opened file stays on top on the sketchup window
@rv1974 said:
Rather bizarre request..
Why one won't just put any desired desktop shortcut instead?
maybe because when sketchup fills your screen entirely, you have to close or reduce the sketchup window to access the shortcut
if the shortcup is inside the sketchup window, you can access it directly
each clic matters...
this is a better version, based on TIG's code in the plugin MIRROR to add a button:
replace
C:\Users\glro\AppData\Roaming\SketchUp\SketchUp 2016\SketchUp\Plugins\MTX\notice_metrix_2016_bd.pdf
by the path to your file
replace the name of module and definition also, and the name of the png file
` require "sketchup"
module MTX
def MTX.notice
UI.openURL("C:\Users\glro\AppData\Roaming\SketchUp\SketchUp 2016\SketchUp\Plugins\MTX\notice_metrix_2016_bd.pdf")
end
end
unless file_loaded?(File.basename(FILE))###
UI.menu("Plugins").add_item("MTX_Notice Metrix"){MTX.notice}
#=begin
UI.add_context_menu_handler do |menu|### v3.5 TIG
#menu.add_separator
menu.add_item("Notice Metrix"){Sketchup.active_model.select_tool(MTX.notice)}
end#do menu###
#=end
png=File.join(File.dirname(FILE),"MTX_notice_Metrix.png")
if FileTest.exist?(png)
tb=UI::Toolbar.new("Notice Metrix")
cmd=UI::Command.new("MI"){Sketchup.active_model.select_tool(MTX.notice)}
cmd.large_icon=png
cmd.small_icon=png
cmd.tooltip="Notice Metrix"
cmd.status_bar_text="Notice Metrix: afficher..."
tb.add_item(cmd)
if tb.get_last_state==TB_NEVER_SHOWN
tb.show
elsif tb.get_last_state==TB_VISIBLE
tb.restore
end#if state
end#if toolbar
end#if loaded
file_loaded(File.basename(FILE))`
@bep said:
@fredo6 said:
Bep,
Actually, the main difficulty is to decide on the icons displayed in the toolbar.
It could be just:
- colors
- Letters, like A, B, C, .... or numbers
- thumbnail of files (more difficult, and not differentiating since rather based on file type)
- a set of predefined icons
In any case, someone has to design these icons.
Fredo
Fredo, i understand and foresaw the difficulty about the icons your explaining.
That is why i asked for a not to fancy script in the first place.
Sam's script almost worked for me, if only it was not limited to Sketchup files.
"I could modify my own button icon, and change the filepath in the ruby script to the file i need to open."
If i needed another tool button to launch another file, i would just copy and rename the ruby script, and put other icons and an other filepath in it.
I could than if i wanted the tool buttons in one toolbar, make a custom toolbar with these buttons placed together in it.Bep
UI.openURL ("") is the code to open any file
this is an example that shows an image on my screen at ""C:\Users\glro\AppData\Roaming\SketchUp\SketchUp 2016\SketchUp\Plugins\MTX\logo.jpg""
just change to the file you need to open
the icon file is in the plugins folder; in that case MCT_LRO.jpg
you can change that too
tb = UI::Toolbar.new("Toolbar Name")
cmd = UI::Command.new("Plugin Name") { Sketchup.open_file UI.openURL("C:\\Users\\glro\\AppData\\Roaming\\SketchUp\\SketchUp 2016\\SketchUp\\Plugins\\MTX\\logo.jpg") }
cmd.tooltip = "Plugin Name"
cmd.status_bar_text = "Plugin Name"
cmd.large_icon = File.join(File.dirname(__FILE__), "MCT_LRO.png")
tb.add_item(cmd)
tb.show unless tb.get_last_state == 0
@dtrarch said:
Mike
Make them construction lines that can be converted to "line"
There are 2 or 3 plugins that do this now.d
good idea
i tried: it works
Even with a construction line inside the component, operations are possible on volumes with sketchup pro
the modified component becomes a group, but if the goal is to get the centerlines only, just delete the surfaces and convert the construction lines into lines
just one idea plus just one idea...
@bmike said:
@glro said:
@bmike said:
Is there a plugin out there that will generate centerlines of components? I'd like to window a bunch of components and have it generate centerlines in order to speed up sending files to an engineer for analysis....
Typical model:
[attachment=1:mpqk94i3]<!-- ia1 -->Screen Shot 2016-06-14 at 11.31.37 AM.png<!-- ia1 -->[/attachment:mpqk94i3]
I'd be happy to do this in '2d' in pieces, so I could generate centerlines for a typical bent:
[attachment=0:mpqk94i3]<!-- ia0 -->Screen Shot 2016-06-14 at 11.46.39 AM.png<!-- ia0 -->[/attachment:mpqk94i3]you could add the centrelines in the components at first, so you
wouldn't have to add themwhich would render them non solid, so useless for using any of the solids tools.
unless you put the centerline on a different layer you could easily remove
just an idea...
@bmike said:
Is there a plugin out there that will generate centerlines of components? I'd like to window a bunch of components and have it generate centerlines in order to speed up sending files to an engineer for analysis....
Typical model:
[attachment=1:vg3or3yz]<!-- ia1 -->Screen Shot 2016-06-14 at 11.31.37 AM.png<!-- ia1 -->[/attachment:vg3or3yz]
I'd be happy to do this in '2d' in pieces, so I could generate centerlines for a typical bent:
[attachment=0:vg3or3yz]<!-- ia0 -->Screen Shot 2016-06-14 at 11.46.39 AM.png<!-- ia0 -->[/attachment:vg3or3yz]
you could add the centrelines in the components at first, so you
wouldn't have to add them
@jql said:
Here is a simple model and layout example in V2013 (if you want another version please say so):
[attachment=4:2jmovtqr]<!-- ia4 -->Flatten Faces Simple_1.png<!-- ia4 -->[/attachment:2jmovtqr]
[attachment=3:2jmovtqr]<!-- ia3 -->Flatten Faces Simple_2.png<!-- ia3 -->[/attachment:2jmovtqr]
[attachment=5:2jmovtqr]<!-- ia5 -->Flatten Faces Simple Model.skp<!-- ia5 -->[/attachment:2jmovtqr]
[attachment=6:2jmovtqr]<!-- ia6 -->Flatten Faces Simple Layout.layout<!-- ia6 -->[/attachment:2jmovtqr]
Axonometric View has Shadows turned on but only in my best dreams would they be able to output to 2D.
I hope you keep having fun
here is the result for some scenes
i am afraid it is not convincing
TIG's plugin surely will give better results
[attachment=2:2jmovtqr]<!-- ia2 -->AL Nasc.skp<!-- ia2 -->[/attachment:2jmovtqr][attachment=1:2jmovtqr]<!-- ia1 -->PLT Cob.skp<!-- ia1 -->[/attachment:2jmovtqr]
@jql said:
there's nothing like trying.
OK for a typical model, each scenes should be prepared for flattening
the basic idea of a plugin could be ruined by memory overload or something else, so it is worth trying before going further
@jql said:
Scaling to 0.0001 will keep this as a 3D that looks flat so face "draw order" comes from the 3D itself... I can understand that.
It's pretty interesting that scaling it to 0 and then scaling it back up pops up the full model!
no, it has to be scaled at 0.0001, otherwise it doesn't pop up back
@jql said:
I could see that as a very interesting presentation tool by itself.
Imagine a flat plane with a google map in it, and then, suddenly a building and terrain start poping up from it... That would be very cool.
But what you're saying is that if you export to dwg/dxf and open it back in sketchup, sketchup convert's it into 2D data, though it looses faces? Then all the invisible faces become visible and if I'm exporting a roof view I will probably see all the floors beneath it... That wouldn't work though what you have still looks very good.
no
if it is scaled to 0.0001 exported to dxf imported to sketchup, faces are erased, but the model is still 3d, you can unscale it
if it is scaled to 0.000, only then faces are erased and it is converted into 2D data
@jql said:
There is also an unmentioned issue that relates to camera, this only works in orthogonal projection mode, but I really can live with that as that is the kind of drawings I am after (2D orthogonal projections of the model.)
Though I understand the potential of the concept there are also other questions envolved like defining axis, sections and export to a skp model per scene:
- Having a section can be a bit more troublesome though as there will be many sections in the model. The way you describe your plugin to work right now, it would probably be a matter of copying the whole model and a given section into a component.
there is no plugin, only the few lines of code i pasted in the thread;i have not tried this code when a section plane is in the model.
@jql said:
Then use the section inside that component to do something like Zorro2 plugin and slice the component through the section. This new component, that would now be sliced, could be scaled flat;
- Then the matter of exporting this flat component to an external file, would probably be easy too.
So the problem I see is, still only one, the component isn't trully 2D but close to 0 thick:
- so it probably isn't fast to work with;
- it's probably innacurate to work with;
- and it probably creates a lot of issues when exporting to standard industry formats like dwg/dxf/dwf.
I'm thinking though, that if there was a way to make the component true 2D, it would be so lightweight and easy to use, that we could even not export it at all. It could be inserted in a new layer visible only in a new scene and both layer and scene could be named after the existing scene with a suffix/prefix related to the plugin:
- "Scene 1" - Original model view;
- "2D Scene 1" - Copy of Original model view, where only the 2D flat component is visible.
i don't see why being close to 0 would be a problem
the flattened component is as accurate as possible, in 2D
the size of the flattened component is not an burden for the graphic card, since it is flat, it is quicly shown; it can be for the RAM
@jql said:
glro, I'm sorry if I'm sounding rude by saying all this so bluntly, but the fact is that I really appreciate all the input so far, and I do think the potential of this plugin is huge!
i have just followed your idea, because i was curious, and it has been fun so far; but i don't have much time to spend on it.
if you send a model with a few scenes set as you wish them to be flattened, with or without a section plane, i can make a try, copy each scene flattened to an individual sketchup file so you can check the result
@jql said:
Then how will Sketchup know it has to keep the visible entities and disregard the rest?
by scaling to 0.0001, the visible entities are kept visible