Skip to main content
12-Amethyst
March 8, 2024
Solved

Macro for IsoDraw 7.3 - Position and insert a new text in a CGM

  • March 8, 2024
  • 1 reply
  • 1432 views

Hello,


Do you know how I can find the bottom right corner position of all the elements of a CGM illustration in order to add a right alignment text just below the drawing  ?

 

Thank you and nice day to all

Best answer by bfriesen

Here are copies of the macro we use. It takes the filename of the idr and places it in the bottom right corner. The second macro does that same thing only it adds a white box under the text.

 

Macro Add_FileName
 
  Define h As Integer
  Define w As Integer
  w = activeDoc.window.pageX-2
  h = 2
 
#Message "The height is " + h
#Message "The width is " + w
 
#Added below command to ensure number is placed on the Illustration number layer
 
  ACTIVATE LAYER "Illustration Number"
Select none
  Text Align Left
  Text font 'Calibri'
  Text size 6
  Create Text w h stripext(activeDoc.name)
  Rotate selection w h 90
 
End Macro
 
Macro Add_FileName_White_BG
 
Define h AS Integer
Define w AS Integer
Define el AS Element
w = activeDoc.window.pageX-2
h = 2
 
#Message "The height is " + h
#Message "The width is " + w
 
#Added below command to ensure number is placed on the Illustration number layer
 
ACTIVATE LAYER "Illustration Number"
Select none
Text Align Left
Text font 'Calibri'
Text size 6
Create Text w h stripext(activeDoc.name)
el = activeDoc.firstSelectedElement
el.text.backfill_color.type = "rgbValues"
el.text.backfill_color.rgb.red = 255
el.text.backfill_color.rgb.green = 255
el.text.backfill_color.rgb.blue = 255                                          
el = el.nextSelectedElement
 
Rotate selection w h 90
Select none        
 
End Macro

1 reply

bfriesen18-OpalAnswer
18-Opal
March 8, 2024

Here are copies of the macro we use. It takes the filename of the idr and places it in the bottom right corner. The second macro does that same thing only it adds a white box under the text.

 

Macro Add_FileName
 
  Define h As Integer
  Define w As Integer
  w = activeDoc.window.pageX-2
  h = 2
 
#Message "The height is " + h
#Message "The width is " + w
 
#Added below command to ensure number is placed on the Illustration number layer
 
  ACTIVATE LAYER "Illustration Number"
Select none
  Text Align Left
  Text font 'Calibri'
  Text size 6
  Create Text w h stripext(activeDoc.name)
  Rotate selection w h 90
 
End Macro
 
Macro Add_FileName_White_BG
 
Define h AS Integer
Define w AS Integer
Define el AS Element
w = activeDoc.window.pageX-2
h = 2
 
#Message "The height is " + h
#Message "The width is " + w
 
#Added below command to ensure number is placed on the Illustration number layer
 
ACTIVATE LAYER "Illustration Number"
Select none
Text Align Left
Text font 'Calibri'
Text size 6
Create Text w h stripext(activeDoc.name)
el = activeDoc.firstSelectedElement
el.text.backfill_color.type = "rgbValues"
el.text.backfill_color.rgb.red = 255
el.text.backfill_color.rgb.green = 255
el.text.backfill_color.rgb.blue = 255                                          
el = el.nextSelectedElement
 
Rotate selection w h 90
Select none        
 
End Macro
jsterlin12-AmethystAuthor
12-Amethyst
March 8, 2024

Thank you very much for this clear and precise explanation !
It helps me understand things better, I'm just starting with Isodraw macros...

 

Unfortunately this does not correspond to my data, because the illustrations that I have to process are not "full page"

I was able to get around this by selecting the elements and working relative to the equivalent rectangle

 

Anyway, thank you very much for your help and for this quick response!!!

Have a nice day 

 

DEFINE nomdoc AS string

DEFINE myElem as Element

 

nomdoc = stripExt(activeDoc.name)


select all
Group Selection

myElem = activeDoc.firstSelectedElement

#MESSAGE myElem.box.top
#MESSAGE myElem.box.left
#MESSAGE myElem.box.bottom
#MESSAGE myElem.box.right

Select none

TEXT FONT "arial"
TEXT SIZE 6
TEXT FACE NORMAL
TEXT ALIGN RIGHT


CREATE TEXT (myElem.box.right - 1 ) (myElem.box.bottom - 10) nomdoc