cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

IsoDraw macro issue - help!

SOLVED
Newbie

IsoDraw macro issue - help!

Hey up everyone - I'm hoping someone may be able to shed some light on a couple of problems I've run into...


1. I"m trying to develop a macro that will correctly format a batch of illustrations. So far everything's going to plan, but what I thought would be the easiest bit is proving the hardest. I want to use the 'fit to page' function, but I can't record it (the function is greyed out) and I can't find any reference in the help manual to script it either. Anyone done this before? After some digging it looks like this may only be a function available in 7.3 - I have 7.2, can anyone confirm?


2. I'm also trying to select any text which is less than 7pt. I have 2 different sizes on the illustration so I can't use the 'font_size is not' function.

I've been trying to develop a macro to select the smaller sized text and then lock it using the box.top and box.bottom parameters, but it fails to select the smaller size text, just the last piece of text on the illustration. It goes like this:


Macro Select text size

# recorded with Arbortext IsoDraw 7.2

DEFINE myElem AS Element

Select IF Type is equal to "Text"

myElem = activeDoc.firstSelectedElement

IF (myElem.box.top - myElem.box.bottom is smaller than 3) THEN

myElem.locked = 1

myElem = myElem.nextSelectedElement

END IF

End Macro


Anyone have any ideas why this doesn't work? In theory it should take the top box parameter and subtract the bottom box parameter of the first selected text element and if it's less than 3 (mm I'm guessing) it should lock it and move on to the next text element. All I get is that last text element locked (after a fashion) no matter what size it is.


Thanks for any ideas you may have.


Cheers


Rob

Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions

Re: IsoDraw macro issue - help!

Sorted it - after much wailing and nashing of teeth:

Select IF Type is equal to "Text"

el = activeDoc.firstSelectedElement

WHILE (Exists (el) = true)

a = el.box.top - el.box.bottom

IF (a < 6 - true) THEN

el.fill = color_black

END IF

el = el.nextSelectedElement

END WHILE

Select none

This routine fills the smaller text with a predefined colour (color_black) which I can then use as a selection criteria in future comands.

Thanks for your keen interest Trevor

12 REPLIES 12

Re: IsoDraw macro issue - help!

Hi Rob

I've a macro that we use to scale the drawing up to fill the page. I think the original came from Trevor Hendricks (so thanks) and I changed it to suit what we needed.

submacro Resize_to_Frame_Specify_Border NOT_IN_MENU

Define Height as Float

Define Width as Float

Define ScalePercentage as Float

Define BorderSize as Float

BorderSize = 10

#SELECT THE WHOLE DRAWING

select all

#Determines height and width of grouped art.

Height = gl_TopCoord - gl_BottomCoord

Width = gl_RightCoord - gl_LeftCoord

#Determines height and width of the Active Document Window and ratio between page size and geometry size so it knows how to work out scale percentage

define page_height as float

define page_width as float

define page_ratio as float

define geometry_ratio as float

page_height = ActiveDoc.window.pageY

page_width = ActiveDoc.window.pageX

page_ratio = page_height / page_width

geometry_ratio = height / width

if (page_ratio < geometry_ratio)

ScalePercentage = (ActiveDoc.window.pageY - bordersize) /(Height)

else

ScalePercentage = (ActiveDoc.window.pageX - bordersize) /(Width)

end if

Zoom Page

#NEXT MOVE THE DRAWING GEOMETRY TO THE CENTRE OF THE PAGE PRIOR TO SCALING IT

define geometry_centre_x as float

define geometry_centre_y as float

define page_centre_x as float

define page_centre_y as float

geometry_centre_x = (gl_leftCoord + ((gl_rightCoord - gl_leftCoord) / 2))

geometry_centre_y = (gl_BottomCoord + ((gl_TopCoord - gl_BottomCoord) / 2))

page_centre_x = (page_width / 2)

page_centre_y = (page_height / 2)

define MoveDistX as float

define MoveDistY as float

MoveDistX = (page_centre_x - geometry_centre_x)

MoveDistY = (page_centre_y - geometry_centre_y)

select all

move selection MoveDistX MoveDistY

#Scales the grouped art to proper size.

Scale Selection page_centre_x page_centre_y ScalePercentage ScalePercentage

Zoom Page

# CLEARS SELECTION

Select None

End submacro

---------------------------------------

The text bit, I just use subselect for text, or does that not do what you need?

select all

Subselect if Type is equal to 'text'

Subselect if Font_size is equal to 8

Hope this helps and I've not totally missed the point.

Re: IsoDraw macro issue - help!

Tim,

Thanks for your help. I'll give the sizing macro a try. Seems a shame to go to so much code when all we really need is for 7.2 to support the 'fit elements' function as 7.3 does.

As for the text part - the problem I have is that the small text I'm trying to select does not conform to an exact size (eg. 8pt), and it is not always the same size. I have text that varies from 11.708 to 11.891. Hence I could do with a function that lets me select if text is less than 12pt, but life is not so easy. That's why I'm tring to use the element box height as a measure of the text size instead.

Thanks for trying.

Cheers

Rob

Re: IsoDraw macro issue - help!

Oh yes I'm sorry I assumed there was a greater/less than option in subselect, but there isn't is there!

Re: IsoDraw macro issue - help!

Could you attach a sample file (dumb it down if needed)?

Re: IsoDraw macro issue - help!

Sorted it - after much wailing and nashing of teeth:

Select IF Type is equal to "Text"

el = activeDoc.firstSelectedElement

WHILE (Exists (el) = true)

a = el.box.top - el.box.bottom

IF (a < 6 - true) THEN

el.fill = color_black

END IF

el = el.nextSelectedElement

END WHILE

Select none

This routine fills the smaller text with a predefined colour (color_black) which I can then use as a selection criteria in future comands.

Thanks for your keen interest Trevor

Re: IsoDraw macro issue - help!

Just a late follow up, but something to think about. I personally try to avoid visual modifications as there may be a failure or something missed. Another approach versus the color would be to apply some object info metadata. Something to keep in mind for next time. The code below is an UNTESTED modification of the accepted code.

Select IF Type is equal to "Text"

el = activeDoc.firstSelectedElement

WHILE (Exists (el) = true)

a = el.box.top - el.box.bottom

IF (a < 6 - true) THEN

Create object_info el

el.Info.Name = "here I am"

END IF

el = el.nextSelectedElement

END WHILE

Select none

Re: IsoDraw macro issue - help!

Trevor,

A late follow up to your late follow up...

That makes absolute sence, don't know why I didn't think of it myself. Thanks for taking the time to give it some thought.

Cheers

Rob

Highlighted

Re: IsoDraw macro issue - help!

Hi,

I used the same macro in 7.1, but it shows an error message as "Invalid command Height = gl_TopCoord - gl_BottomCoord

Does this command does not work in 7.1?

Re: IsoDraw macro issue - help!

I believe I wrote that code while using 7.1 (we're now on 7.3). The problem appears to be that gl_TopCoord and gl_Bottom_Coord variables are not defined. Believe these need to be set as global if memory serves me correctly.