Problem

As most other ArchiCAD elements (excepted roofs and beams) objects can't be rotated free in space. At least not by their general settings and attributes. But there are the general transforming commands ROTX, ROTY and ROTZ, which can be used at the beginning of the script to get this done. There are several tutorials available to get this done for existing objects, but most are supposed to be used by GDL beginners and do not add moveable hotspots for justage in 3D.

Solution

This solution ios a bit different ... and not. Yes, you have to open and to modify the object, but not all manual. One hurdle is often to create new additional parameters for the rotation angle. This is here done by switching to a new subtype, which brings the needed parameters.

Follow these steps:
  • Download (from below), extract and copy the subtype template ModelRotated.GSM to your library an reload it in your project (if this has not been done before).
  • Open the object to be modified or create a new one.
  • If there are any more blue parameters in the objects parameter list than a,b,zzyzx and ac_show2dhotspotsin3d STOP HERE!
  • Save the object with a new name.
  • Click on subtypes button.
  • Select ModelRotated and close dialog.
Now all needed Parameters are added to your object file. Before you add the script code you have to decide which solution to prefer:
  1. Small solution: Rotation by entering the values in the object settings.
  2. Big solution: Full rotation control in settings dialog and 3D window.
Completing the :
  • Select the relevant scripts in the frames below and copy and paste it at the beginning of their belonging scripts in your object.
  • Do your preselections for the parameters. The parameter ef_rot_type switches between rotating about two (X/Y) or all three axis. I recommend 2 axis is enough.
  • At least you have to save the object
If you want to fix probably colliding DEL TOP commands switch finally  to 3D window and search and replace the following therms:
  • search:  DEL TOP
  • replace with:  DEL NTR()-3*ef_rotation

2D Script - both solutions

!»» Project 3d-model if rotated.

IF ef_rotation THEN

  PEN gs_cont_pen
  FILL gs_fill_type

  PROJECT2{2} 3, 270,
    3 + 16*1 + 32*0 + 64*0,
    !»»» uncomment for third version
    !    of PROJECT2-command in AC10:
    ! 3 + 12,
    gs_fill_pen,
    0,0,0

  PEN SYMB_VIEW_PEN
  END

  ENDIF


!»» ………

parameter script - small solution

!»» Custom rotation

LOCK "ef_rot_htspt","ef_help","ef_StiftHL"
HIDEPARAMETER "ef_rot_htspt","ef_help","ef_StiftHL"

IF ef_rotation THEN

  VALUES "ef_rot_type" "X+Y","X+Y+Z"

  PUT 0,10,15,30,45,60,75,90,120,135,150,180
  PUT 210,225,240,270,300,315,330,360
  IF ef_rot_type="X+Y+Z" THEN
    VALUES "ef_rotZ" USE(nsp),CUSTOM,RANGE [ 0,360)
    ELSE
    LOCK "ef_rotZ" : HIDEPARAMETER "ef_rotZ"
    ENDIF
  VALUES "ef_rotX" USE(nsp),CUSTOM,RANGE [ 0,360)
  VALUES "ef_rotY" GET(nsp),
CUSTOM,RANGE [ 0,360)

  ELSE

  LOCK
"ef_rotX","ef_rotY","ef_rotZ","ef_rot_type"
  LOCK "gs_cont_pen","gs_fill_type","gs_fill_pen","gs_back_pen"

  HIDEPARAMETER "ef_rotX","ef_rotY","ef_rotZ","ef_rot_type"
  HIDEPARAMETER "gs_cont_pen","gs_fill_type","gs_fill_pen","gs_back_pen"

  ENDIF

!»» ………

parameter script - big solution

!»» Custom rotation

IF ef_rotation THEN

  VALUES "ef_rot_type" "X+Y","X+Y+Z"

  PUT 0,10,15,30,45,60,75,90,120,135,150,180
  PUT 210,225,240,270,300,315,330,360
  IF ef_rot_type="X+Y+Z" THEN
    VALUES "ef_rotZ" USE(nsp),CUSTOM,RANGE [ 0,360)
    ELSE
    LOCK "ef_rotZ" : HIDEPARAMETER "ef_rotZ"
    ENDIF
  VALUES "ef_rotX" USE(nsp),CUSTOM,RANGE [ 0,360)
  VALUES "ef_rotY" GET(nsp),
CUSTOM,RANGE [ 0,360)

  IF ef_rot_htspt THEN
    VALUES "ef_help" 0.05,0.1,0.5,0.75,1,5,10,CUSTOM,RANGE ( 0,)
    ELSE
    LOCK
"ef_help","ef_StiftHL"
    ENDIF

  ELSE

  LOCK
"ef_rotX","ef_rotY","ef_rotZ","ef_rot_type"
  LOCK "gs_cont_pen","gs_fill_type","gs_fill_pen","gs_back_pen"
  LOCK "ef_rot_htspt","ef_help","ef_StiftHL"

  HIDEPARAMETER "ef_rotX","ef_rotY","ef_rotZ","ef_rot_type"
  HIDEPARAMETER "gs_cont_pen","gs_fill_type","gs_fill_pen","gs_back_pen"
  HIDEPARAMETER "ef_rot_htspt","ef_help","ef_StiftHL"

  ENDIF

!»» ………

3D script - small solution

! »»»  Rotation of the system

IF ef_rotation THEN


  ROTX ef_rotX
  ROTY ef_rotY
  IF ef_rot_type="X+Y+Z" THEN ROTZ ef_rotZ ELSE ROTZ 0

  ENDIF

!»» ………

3D script - big solution

! »»»  Rotation of the system

IF ef_rotation AND ef_rot_htspt AND ef_help>0 THEN

  htspt=7000 : HOTSPOT 0,0,0, htspt

  !» X-rotation handle at Z-axis
  htspt=htspt+1 : HOTSPOT 0, 0,0, htspt, ef_rotX, 6
  htspt=htspt+1 :
HOTSPOT 0,0,.1, htspt, ef_rotX, 4+128
  htspt=htspt+1 :
HOTSPOT .1,0,0, htspt, ef_rotX, 7
  ROTX ef_rotX
  htspt=htspt+1 :
HOTSPOT 0,0,ef_help, htspt, ef_rotX, 5
  IF ef_StiftHL>0 THEN
    PEN ef_StiftHL
    LIN_ 0,0,0,0,0,ef_help
    PEN SYMB_VIEW_PEN
    ENDIF
 
  !» Y-rotation handle at X-axis
  htspt=htspt+1 :
HOTSPOT 0,0, 0, htspt, ef_rotY, 6
  htspt=htspt+1 :
HOTSPOT .1,0, 0, htspt, ef_rotY, 4+128
  htspt=htspt+1 :
HOTSPOT 0,.1,0, htspt, ef_rotY, 7
  ROTY ef_rotY
  htspt=htspt+1 :
HOTSPOT 2*ef_help/3,0,0, htspt, ef_rotY, 5
  IF ef_StiftHL>0 THEN
    PEN ef_StiftHL
    LIN_ 0,0,0,2*ef_help/3,0,0
    PEN SYMB_VIEW_PEN
    ENDIF

 
  !» Z-rotation handle at X-axis
  IF ef_rot_type="X+Y+Z" THEN
    htspt=htspt+1 :
HOTSPOT 0, 0,0, htspt, ef_rotZ, 6
    htspt=htspt+1 :
HOTSPOT .1, 0,0, htspt, ef_rotZ, 4+128
    htspt=htspt+1 :
HOTSPOT 0,0,.1, htspt, ef_rotZ, 7
    ROTZ ef_rotZ
    htspt=htspt+1 :
HOTSPOT ef_help/3,0,0, htspt, ef_rotZ, 5
    IF ef_StiftHL>0 THEN
      PEN ef_StiftHL
      LIN_ 0,0,0,ef_help/3,0,0
      PEN SYMB_VIEW_PEN
      ENDIF
    ELSE
    ROTZ
0
    ENDIF

  ELSE

  !»» rotation if handles switched off or hlp lines too short.
  ROTX ef_rotX
  ROTY ef_rotY
  IF ef_rot_type="X+Y+Z" THEN ROTZ ef_rotZ ELSE ROTZ 0

  ENDIF

!»» ………

Parameterlist (XML)

        <Boolean Name="ef_rotation">
            <Description><![CDATA["Object rotation"]]></Description>
            <Value>0</Value>
        </Boolean>
        <String Name="ef_rot_type">
            <Description><![CDATA["‚...Rotation handles for axis"]]></Description>
            <Flags>
                <ParFlg_Child/>
                <ParFlg_SHidden/>
                <ParFlg_Disabled/>
                <ParFlg_Hidden/>
            </Flags>
            <Value><![CDATA["X+Y"]]></Value>
        </String>
        <Angle Name="ef_rotX">
            <Description><![CDATA["‚...Rotation X-axis"]]></Description>
            <Flags>
                <ParFlg_Child/>
                <ParFlg_SHidden/>
                <ParFlg_Disabled/>
            </Flags>
            <Value>0</Value>
        </Angle>
        <Angle Name="ef_rotY">
            <Description><![CDATA["‚...Rotation Y-axis"]]></Description>
            <Flags>
                <ParFlg_Child/>
                <ParFlg_SHidden/>
                <ParFlg_Disabled/>
            </Flags>
            <Value>0</Value>
        </Angle>
        <Angle Name="ef_rotZ">
            <Description><![CDATA["‚...Rotation Z-axis"]]></Description>
            <Flags>
                <ParFlg_Child/>
                <ParFlg_SHidden/>
                <ParFlg_Disabled/>
            </Flags>
            <Value>0</Value>
        </Angle>
        <Boolean Name="ef_rot_htspt">
            <Description><![CDATA["Show rotation handles in 3D"]]></Description>
            <Flags>
                <ParFlg_Child/>
                <ParFlg_SHidden/>
                <ParFlg_Disabled/>
            </Flags>
            <Value>0</Value>
        </Boolean>
        <Length Name="ef_help">
            <Description><![CDATA["‚...Length of help lines"]]></Description>
            <Flags>
                <ParFlg_Child/>
                <ParFlg_SHidden/>
                <ParFlg_Disabled/>
            </Flags>
            <Value>0.1</Value>
        </Length>
        <PenColor Name="ef_StiftHL">
            <Description><![CDATA["‚...Pen for help lines"]]></Description>
            <Flags>
                <ParFlg_Child/>
                <ParFlg_SHidden/>
                <ParFlg_Disabled/>
            </Flags>
            <Value>0</Value>
        </PenColor>
        <PenColor Name="gs_cont_pen">
            <Description><![CDATA["Countour pen"]]></Description>
            <Flags>
                <ParFlg_Child/>
                <ParFlg_SHidden/>
                <ParFlg_Disabled/>
            </Flags>
            <Value>1</Value>
        </PenColor>
        <FillPattern Name="gs_fill_type">
            <Description><![CDATA["Background fill type"]]></Description>
            <Flags>
                <ParFlg_Child/>
                <ParFlg_SHidden/>
                <ParFlg_Disabled/>
            </Flags>
            <Value>6</Value>
        </FillPattern>
        <PenColor Name="gs_fill_pen">
            <Description><![CDATA["‚...Fill pen"]]></Description>
            <Flags>
                <ParFlg_Child/>
                <ParFlg_SHidden/>
                <ParFlg_Disabled/>
            </Flags>
            <Value>3</Value>
        </PenColor>
        <PenColor Name="gs_back_pen">
            <Description><![CDATA["‚...Background fill pen"]]></Description>
            <Flags>
                <ParFlg_Child/>
                <ParFlg_SHidden/>
                <ParFlg_Disabled/>
                <ParFlg_Hidden/>
            </Flags>
            <Value>0</Value>
        </PenColor>

Documents

 TitleOwnerCategoryModified DateSize 
ModelRotated.gsmFrank Beister 5/30/20077.48 KBDownload
Um unsere Webseite für Sie optimal zu gestalten und fortlaufend verbessern zu können, verwenden wir nur essenzielle Cookies.
Durch die weitere Nutzung der Webseite stimmen Sie der Verwendung von Cookies zu.
Weitere Informationen zu Cookies erhalten Sie in unserer Datenschutzerklärung