• Login
sketchucation logo sketchucation
  • Login
πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

Text position problem

Scheduled Pinned Locked Moved Developers' Forum
23 Posts 5 Posters 2.5k Views 5 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    Jorgensen
    last edited by 5 Feb 2008, 20:18

    Hi Didier

    Thank - you have allready helped. I'll se what I can fix myself.

    By the help from this forum, it might be possible πŸ˜„

    Jorgensen

    sketchup pro 2016 16.1.1449 64 bit | windows 10 pro | i7-3770k @3.5 GHz | 16gb ram | gtx 780 ti / gtx 980 ti | nvidia driver 368.39

    1 Reply Last reply Reply Quote 0
    • J Offline
      Jorgensen
      last edited by 6 Feb 2008, 20:11

      Hi

      I have a question about the Sketchup.format_area utility.

      My model is in mm, but I would like the result to be in m2 not as Sketchup.format_area shows mm2 - is this somehow possible ?

      Thanks

      sketchup pro 2016 16.1.1449 64 bit | windows 10 pro | i7-3770k @3.5 GHz | 16gb ram | gtx 780 ti / gtx 980 ti | nvidia driver 368.39

      1 Reply Last reply Reply Quote 0
      • J Offline
        Jorgensen
        last edited by 7 Feb 2008, 07:59

        Its now going the right way... πŸ˜„

        I have one question.
        I have a group on each level of the building (the levelGroup). Each levelGroup contains a number of groups, that holds info for each room, the area and name. roomGroups.

        I then doubbleclick, and get inside a levelgroup, and update the roomGroups.

        To keep track of the roomGroups I use:
        target = Sketchup.active_model.active_entities;
        $areaObjects.push target.add_text text, coordinates

        I then have an array $areaObjects, that cointain all the text added (roomGroups).
        If I wan't to delete/update all the text, I can read the array again and then erase! them, but this will delete all the text on in all levelGroups.

        Is there a way to tjek if the roomGroup is inside the active group ?

        Thanks
        Jorgensen

        sketchup pro 2016 16.1.1449 64 bit | windows 10 pro | i7-3770k @3.5 GHz | 16gb ram | gtx 780 ti / gtx 980 ti | nvidia driver 368.39

        1 Reply Last reply Reply Quote 0
        • D Offline
          Didier Bur
          last edited by 7 Feb 2008, 14:39

          @unknownuser said:

          I would like the result to be in m2 not as Sketchup.format_area shows mm2 - is this somehow possible ?

          Yes:
          Switch to meters unit just before the format_area instruction, then switch back to mm:

          old_unit=Sketchup.active_model.options["UnitsOptions"]["LengthUnit"]
          Sketchup.active_model.options["UnitsOptions"]["LengthUnit"]=4
          
          then_call_the_format_area_instruction_here
          (result is a string so it would'nt be affect by later changes)
          
          Sketchup.active_model.options["UnitsOptions"]["LengthUnit"]=old_unit
          (to switch back to mm in your case
          

          DB

          1 Reply Last reply Reply Quote 0
          • J Offline
            Jorgensen
            last edited by 7 Feb 2008, 18:21

            Hi Didier

            Thanks for your reply. Just the way I would do, I just could'nt find the settings in Ruby.

            One problem however, the text now becomes 14 Meters2 - should be 14 M2 - I guess I'll have to do somekind ereg_replace....

            Thanks for your help.
            Jorgensen

            sketchup pro 2016 16.1.1449 64 bit | windows 10 pro | i7-3770k @3.5 GHz | 16gb ram | gtx 780 ti / gtx 980 ti | nvidia driver 368.39

            1 Reply Last reply Reply Quote 0
            • J Offline
              Jorgensen
              last edited by 7 Feb 2008, 18:26

              Easy area = area.sub("eters ", "") πŸ˜„

              This is fun 😍

              sketchup pro 2016 16.1.1449 64 bit | windows 10 pro | i7-3770k @3.5 GHz | 16gb ram | gtx 780 ti / gtx 980 ti | nvidia driver 368.39

              1 Reply Last reply Reply Quote 0
              • T Offline
                TIG Moderator
                last edited by 7 Feb 2008, 18:31

                I did an AreaFormat tool a while ago... see: http://www.sketchucation.com/forums/scf/viewtopic.php?p=12808#p12808
                It could easily be adjusted to suit your current units if they are not listed...

                TIG

                1 Reply Last reply Reply Quote 0
                • J Offline
                  Jorgensen
                  last edited by 7 Feb 2008, 18:54

                  Thanks TIG - I'll have a look at it...

                  Right now I have a problem, actual the last before I can use the script at work...

                  I use this to tjek and delete objects in the active group:
                  def tmAreaDelete
                  objects_active = Sketchup.active_model.active_entities
                  for object in objects_active
                  if($areaObjects.include?object)
                  object.erase! unless object.deleted?
                  $areaObjects.delete object
                  end
                  end
                  end

                  What teases me, is I have to run the tmAreaDelete tree times to delete all text objects - and I just can't se why 😞 It works if I skip the line '$areaObjects.delete object' but that can't be a good solution.

                  Jorgensen

                  sketchup pro 2016 16.1.1449 64 bit | windows 10 pro | i7-3770k @3.5 GHz | 16gb ram | gtx 780 ti / gtx 980 ti | nvidia driver 368.39

                  1 Reply Last reply Reply Quote 0
                  • J Offline
                    Jorgensen
                    last edited by 7 Feb 2008, 21:05

                    And a other problem:
                    The array $areaObjects, is not saved inside the file - so next time it is loaded - one have to manuel delete all the textobjects and add newones -

                    Is there a smart workaround here ?

                    Thanks
                    Jorgensen

                    sketchup pro 2016 16.1.1449 64 bit | windows 10 pro | i7-3770k @3.5 GHz | 16gb ram | gtx 780 ti / gtx 980 ti | nvidia driver 368.39

                    1 Reply Last reply Reply Quote 0
                    • J Offline
                      Jorgensen
                      last edited by 8 Feb 2008, 09:36

                      It seems that I can use
                      model = Sketchup.active_model
                      data = model.get_attribute "TM_area", "textObjects", "default"
                      and
                      value = model.set_attribute "TM_area", "textObjects", objects

                      sketchup pro 2016 16.1.1449 64 bit | windows 10 pro | i7-3770k @3.5 GHz | 16gb ram | gtx 780 ti / gtx 980 ti | nvidia driver 368.39

                      1 Reply Last reply Reply Quote 0
                      • D Offline
                        daiku
                        last edited by 9 Feb 2008, 02:19

                        J:

                        You are deleting entities from the active entities list while you are iterating over the same list. In other words, you are scrambling the list whilst travesing it. Don't do that. Collect all your enities into a seperate list. Then interate through that list and delete them. CB.

                        Clark Bremer
                        http://www.northernlightstimberframing.com

                        1 Reply Last reply Reply Quote 0
                        • 1
                        • 2
                        • 2 / 2
                        2 / 2
                        • First post
                          22/23
                          Last post
                        Buy SketchPlus
                        Buy SUbD
                        Buy WrapR
                        Buy eBook
                        Buy Modelur
                        Buy Vertex Tools
                        Buy SketchCuisine
                        Buy FormFonts

                        Advertisement