Quantcast
Channel: PTC Community: Message List - Arbortext
Viewing all articles
Browse latest Browse all 3717

Re: IsoDraw macro issue - help!

$
0
0

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.


Viewing all articles
Browse latest Browse all 3717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>