sketchucation logo sketchucation
    • Login
    1. Home
    2. pdonner
    3. Posts
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
    P
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 13
    • Posts 69
    • Groups 1

    Posts

    Recent Best Controversial
    • RE: Add_3d_text height

      Thanks Dan for updating my pointers. I cannot find the corresponding Win32API and win32ole documentation among these neatly structured pages. Could you kindly supply the references so that our thread is completed.

      The Sketchucation thread is very useful indeed. Good work.

      posted in Developers' Forum
      P
      pdonner
    • RE: Add_3d_text height

      Just to clarify this (Ruby programming) topic a few steps further:

      The full documentation for the unpack formatting 'directives' of the referencing string can be found in the 'Programming Ruby' book at:

      http://www.ruby-doc.org/docs/ProgrammingRuby/html/ref_c_string.html

      Similarly, the documentation for the pack function - which transfers the contents of an array into a binary sequence - can be found at:

      http://www.ruby-doc.org/docs/ProgrammingRuby/html/ref_c_array.html#Array.pack

      posted in Developers' Forum
      P
      pdonner
    • RE: Add_3d_text height

      The declaration seems to be ok. And David Thomas' and Andrew Hunt's book 'Programming Ruby' seems to contain some helpful advice on how to pack and unpack binary data structures in Ruby. Cf. http://www.ruby-doc.org/docs/ProgrammingRuby/html/lib_windows.html, subtopic ClassWin32API (actually a quotation from the Ruby distribution, in ext/Win32API) - if someone is interested in how this is supposed to work.

      The space for the data structure is reserved by initializing a string, which can then be referenced after using the unpack function.

      lpTextMetrics = " " * 60 # TEXTMETRIC size
      
      GetTextMetrics.Call(hdc,lpTextMetrics)
      tmHeight, tmAscent, tmDescent  = lpTextMetrics.unpack("LLL")
      
      puts "tmHeight = #{tmHeight}"
      

      Thanks Dan and TIG for friendly help!

      posted in Developers' Forum
      P
      pdonner
    • RE: Add_3d_text height

      I got this far on my own:

      require 'sketchup' 
      require 'Win32API'
      
      GetDesktopWindow = Win32API.new("user32", "GetDesktopWindow", [], 'L')
      GetDC = Win32API.new("user32", "GetDC", ['L'], 'L')
      SetMapMode = Win32API.new("gdi32", "SetMapMode", ['L','N'], 'N')
      
      MM_HIENGLISH = 5
      
      hwnd = GetDesktopWindow.Call
      puts "hwnd = #{hwnd}"
      hdc = GetDC.Call(hwnd)
      puts "hdc = #{hdc}"
      
      mapmodeDefault = SetMapMode.Call(hdc, MM_HIENGLISH)
      puts "mapmodeDefault = #{mapmodeDefault}"
      

      Everything looks quite fine to this point. Now I would have to set up the TEXTMETRIC structure. I find the notations a bit difficult to grasp. So how should I declare TEXTMETRIC and pass it as a parameter in my GetTextMetrics call?

      And what about this Ruby declaration:

      GetTextMetrics = Win32API.new("gdi32", "GetTextMetrics", ['L','P'], 'V')

      posted in Developers' Forum
      P
      pdonner
    • RE: Add_3d_text height

      In a Windows program I would select the font and study text extents of a string like 'Åg' or then I could have a look at the textmetric structure of the font. In the TEXTMETRIC structure the measures are in logical units, i.e. they depend on the mapping mode. By selecting a HIMETRIC mapping mode the measure would be fine enough for our purpose.

      This can be achieved with the Win32API module that Dan was referring to, but this would lead to a Windows only solution (which in this particular case would be adequate). I would, however, like to know how the 3D Text height should be calculated regardless of the OS (or monitor brands for that matter).

      posted in Developers' Forum
      P
      pdonner
    • RE: Add_3d_text height

      Thanks Dan for feedback.

      @dan rathbun said:

      3D_text is not a screen font, it's a 3D entity that's why the height is specified in inches. The 3Dtext is actually drawn with Sketchup edges and faces (approximating the given fontface,) then grouped.

      Yes, I already understood all that and I also know how to hide the edges and how to move the group to the correct location etc. But I do fail to calculate the correct height (unless I would fall back on OS dependent Win32 textmetrics).

      @dan rathbun said:

      It gets smaller visually when you zoom out, and larger when you zoom in, so point size is really meaningless.

      In my scenario this wouldn't be the case. I'm writing a converter from PowerPoint to SketchUp. Therefore the dimensions of the 3D text geometry must match other aspects of the conversion which are based on cm (or inch) measures. The PowerPoint TextBox shape is based on a font, where size is indicated in points.

      Cf. the thread 'How to import a PowerPoint slide?'
      http://forums.sketchucation.com/viewtopic.php?f=79&t=37610

      posted in Developers' Forum
      P
      pdonner
    • Add_3d_text height

      In the add_3d_text api documentation there is a parameter specifying the height of the text, 'letter_height' which is defined as "Height of the text in inches."

      Assuming that we know the points of the font we would like to use, I would like to know the correct formula of calculating the letter_height parameter? A point is 1/72 of an inch and I would also be able to calcultate the height by using Win32 calls, but is there a more general way of handling this matter in SU?

      posted in Developers' Forum
      P
      pdonner
    • RE: Interprocess communication

      Thanks, Dan. Your advice was very useful. I could have lost a lot of time on the other schemes which I referred to. The 'Programming Ruby' book by David Thomas and Andrew Hunt looks interesting.

      Downloaded the .so extension modules, installed them and run a Ruby console session:

      >require 'win32ole'
       true
      
      >ppt = WIN32OLE.new("PowerPoint.Application")
      #<WIN32OLE;0x11396c58>
      
      >ppt.Activate
      nil
      

      That's it: PowerPoint was activated, so I'm ready to use PPT automation in a SU script as desired. Really elegant.

      This scheme depends on the WIN32OLE extension written by Masaki Suketa. Can anybody give me advice on standard procedures for installation of such extensions on the machines of SU users.

      My post had another aspect: We are now capable of using Ruby as a client for Windows Automation. What about the other direction. Can SU be extended to become an automation server?

      posted in Developers' Forum
      P
      pdonner
    • RE: How to import a PowerPoint slide?

      Gaius' #1-5 recipee brought the topic back to newbie level. Yes. Wireframe is the correct procedure to choose all edges and then hide them. Something that I didn't think of. Deselecting every face of the 3D letters manually can be tiresome. But I guess that TIG does this with one or two lines in his Ruby script.

      posted in Newbie Forum
      P
      pdonner
    • Interprocess communication

      So... made a jump from Newbies to the forum of the big boys: Developers' Forum. - I'm interested in ways of controlling SU externally and in ways of communicating with another app from SU.

      I would basically like to write a conversion between PPT diagrams and a simple top view of similar SU objects, which would enable me to make nice renderings of the diagrams by using SU styles and 3D rendering methods.

      This kind of interprocess communication can of course be handled by putting out a csv file, which would describe the diagram entities. This file could then be handled by a SU plugin. Someone seems to be writing ruby temp files which are activated as a SU command line argument or a ruby load. Then there is the possibility of embedding scripts in a WebDialog, and so forth.

      Basically I would like to study in what ways SU and Windows automation can work together in an intimate way; ideally in a way whereby changes in one app (now PPT) would be reflected in the other (SU).

      What are the best method of creating this kind of an interconnection?

      posted in Developers' Forum
      P
      pdonner
    • RE: How to import a PowerPoint slide?

      Stupid me. I should have been able to figure out this trivial matter by myself. This is why I'm insisting on posting on the Newbie forum. Because there is so much to learn before I cease being a newbie.

      3D Text, hidden and not so hidden edges
      Dave's demonstration also explained why the lines were hidden away in the 3D rendered model. Because lines are being hidden at the same time as the edges. - I guess I'm through now with all conversion problems or am I?

      The next task of generating a PPT slide in a SU window should perhaps be discussed in a Ruby (newbie) thread and not here in the Newbie forum.

      posted in Newbie Forum
      P
      pdonner
    • RE: How to import a PowerPoint slide?

      I think I understood what Dave proposed: Combine styles with scenes and export the scenes to a bitmap tool which can handle layers. Seems to work, but it brings in yet another (third) tool where you can combine the layers.

      But TIG suggests that we should create everything directly in SU by hiding edges of the text:

      @unknownuser said:

      My 2Dtext has its edges hidden - so unless you use a Style showing hidden-geometry the 'flat' 3d-text that's used in 2Dtext shows as a set of unedged faces [colored as you specified]

      • 3D Text: not extruded, colored, no edges

      Is there a way of doing this in the GUI without affecting all entities. Can we hide edges of one object without affecting the other ones?

      posted in Newbie Forum
      P
      pdonner
    • RE: How to import a PowerPoint slide?

      Thank Dave R for many good points which I will have to study carefully.

      @unknownuser said:

      What about the 2D/3D question?

      I wanted to point out that limiting myself to a 2D scenario would diminish a number of alternatives, which would make the solution less valid for a number of situations. - The tool should generate one set of diagrams which can quickly be adapted in many ways according to the customer's aspirations and taste.

      I tried to use '3D Text' and without extrusion. That would be very powerful indeed. Unfortunately I couldn't find a way of excluding text elements from style transformations and so the text turned often out to be quite unreadable. Maybe your advice contains some hints to resolve this problem. Otherwise I will have to find out how TIG created his 2D Text objects.

      posted in Newbie Forum
      P
      pdonner
    • RE: How to import a PowerPoint slide?

      @dave r said:

      What is it you're after for a final product?

      I'm considering a task to make some 30 diagram illustrations for a book. While evaluating the job I came to the conclusion that PowerPoint has a number of advantages: An easy-to-use GUI with a number of tools and functionality which makes the design process easy and the diagram content neatly aligned, with centered text etc. The embedded storage of the file can hold all the source material in the same place, giving me a possibility of changing the diagram appearance by quickly running macros on the whole set of diagrams without having to redesign every image.

      While also being programmable, SU has some excellent qualities which can help me render material in a number of ways: Style, 3D etc. So I got the idea that maybe there was need for a generalized method of designing and processing diagram material with the help of these two tools.

      Writing VBA scripts for PPT is a trivial task. I already made a loop which enumerates all the slides and their graphical objects for another job. So I thought that importing them in a ruby wouldn't be much of a challenge. As I pointed out: My validation effort showed that there are some obstacles. But is this too much of a job to balance the obvious advantages of a sustainable tool?

      posted in Newbie Forum
      P
      pdonner
    • RE: How to import a PowerPoint slide?

      @tig said:

      You'd have to pre-process it into an image-file

      Thanks TIG for your opinion, which I appreciate much. I've done some PPT programming and thought it shouldn't be too much of a challenge to make a conversion which would preserve the essential dimensions and other formatting.

      I did some experimentation manually. One problem was that the text isn't very easy to handle in SU. But 2D Text in your 2DTools offers a solution. So I thought this could... and should be done.

      Converting to an image file doesn't any more give me the opportunity to take advantage of the many nice ways that SU gives us to create catchy 3D effects. I also like style based automatic formatting.

      The idea is to take advantage of PPT's tools in making quick design and formatting. Then I would transfer it to SU and use a style to give it a nice appearance.

      Example diagram (not finished yet)
      Same skp file with 3D, perspective and other style
      Lost TIG's 2D lines when I removed the edges. Minor problem which is easy to solve. Hopefully the illustrations help in understanding my aims.

      posted in Newbie Forum
      P
      pdonner
    • How to import a PowerPoint slide?

      I'm wondering if there is a way of importing a PPT diagram into SU. SketchUcation has a thread on a similar, but much more challenging task - namely importation of WMF files. But didn't really find anything of value on this special case.

      posted in Newbie Forum sketchup
      P
      pdonner
    • RE: Automated house model from height coordinates

      Found a company, TerraSolid, in our neighborhood which produces programs for processing of this kind of data. Unfortunately their applications cost zillions, so it seems I have to go on with the started project. There is an open source activity at http://liblas.org/ which seems to be very useful. They feature a list of other commercial packages which seem to be based on the os library.

      The liblas library is based on work done by Martin Isenburg and Jonathan Shewchuk, who are also authors of a set of command line LAS utilities called LAStools at http://www.cs.unc.edu/~isenburg/lastools/, which seems to achieve much of the essential groundwork for our project.

      Martin's utility "lasclip.exe clips away points falling into polygonal shapes (e.g. complex building footprints)." If the LAS file contains projection information, the las2dem.exe will also "be able to create a KML file that geo-references the DEM for display within Google Earth". The two developers also produced an interesting article "Visualizing LIDAR in Google Earth" http://www.cs.unc.edu/~isenburg/googleearth/

      Detail of las2dem output
      For a map view of the same area see: http://tinyurl.com/455gcft

      posted in Newbie Forum
      P
      pdonner
    • RE: Automated house model from height coordinates

      Finally received the test data. The points are stored according to the LAS 1.2 specification. It doesn't seem to be very complicated. As the files are huge (e.g. 10801812 points of 28 bytes each), I guess I will anyway have to write my own routines. But in case someone has experience of the same kind of data it could be helpful to connect.

      posted in Newbie Forum
      P
      pdonner
    • RE: Importation from 3D Studio Max or AutoCAD

      Hi dedmin. I downloaded and installed Blender. Yes, there is a File > Import > X3D Extensible 3D (.x3d/.wrl) command, but wasn't lucky with my test material. As far as I can see, the command did nothing. There seems to be some kind of conversion script behind the command, but maybe my files are too old?

      posted in Newbie Forum
      P
      pdonner
    • RE: Importation from 3D Studio Max or AutoCAD

      The preceding suggestion was apparently not meant to be advice on how to act on the VRML material.

      Should I interpret this to mean that there is no conversion from WRL files to SketchUp?

      posted in Newbie Forum
      P
      pdonner
    • 1
    • 2
    • 3
    • 4
    • 1 / 4