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

Re: IsoDraw macro issue - help!

need to be set as global? what is that?

Can you tell me one example?

Re: IsoDraw macro issue - help!

I think you need to set the variable as global. Such a call would look like the following.

Global myVariable as String

As a side note, make sure to look over the macro help found under the help menu. There's a lot of good stuff in there. One thing that PTC is really good about is their documentation.

Re: IsoDraw macro issue - help!

I am trying to make object that is created to be made under a separate layer when generated. If the layer exist, then create is the prompt I am having issues with. Keep getting "if(exists(active layer 'ARROW'.name)=false) then" Error in expression syntax.

 

# recorded with Arbortext IsoDraw 7.2

define el as Element
define el2 as element
define spx as float
define spy as float
define epx as float
define epy as float
define ang as float
define ang2 as float
define xdef as float
define ydef as float
define div as float
define pt_end as point
define k as ColorSpec
define lyrNm as string

define me as MouseEvent 
define ptx1 as Point # x value of user selected point 
define pty1 as Point # y value of user selected point
define ptx2 as Point # x value of user selected point 
define pty2 as Point # y value of user selected point

if(exists(active layer 'ARROW'.name) = false) then
  add layer 'ARROW' .0
  activeDoc.Pens["LW_Medium"].name = "LW_Medium"
    end if

me = Wait MouseClick
        if (me.click = 0 || me.click = 1) then
            # left mouse pressed
            ptx1 = me.ptMM
            pty1 = me.ptMM
        end if   
me = Wait MouseClick
         if (me.click = 0 || me.click = 1) then
            ptx2 = me.ptMM           
            pty2 = me.ptMM
          end if 
           
Create line ptx1.x pty1.y ptx2.x pty2.y

k.type = "colorRef"
 k.color = "$ISO_BLACK"
 k.tone = 1.00
define myFill as fill
 myFill.type = "color"
 myFill.colSpec=k
define id_blue as ColorSpec
 id_blue.type = "rgbValues"
 id_blue.rgb.red = 128
 id_blue.rgb.green = 128
 id_blue.rgb.blue = 255
 if(exists(activedoc.pens["LW_Medium"].name) = false)then
  add pen "LW_Medium" .1
  activeDoc.Pens["LW_Medium"].screenColor = id_blue
  activeDoc.Pens["LW_Medium"].name = "LW_Medium"
  activeDoc.pens["LW_Medium"].switchPen = "LW_Medium"
 end if
 el = activeDoc.firstSelectedElement
 lyrNm = el.layer.name
 el.line.segments[1].pen = "LW_Medium"
 el.line.segments[1].halo = "Autom. Long"
 spx = el.line.startPoint.x
 spy = el.line.startPoint.y
 epx = el.line.segments[1].endPoint.x
 epy = el.line.segments[1].endPoint.y
 pt_end.x = epx
 pt_end.y = epy
 xdef = epx - spx
 ydef = epy - spy
 if(abs(ydef)<0.001)then
   ydef=0.01
  end if
 div = xdef / ydef
 ang = arctan(div)
 ang2 = 90 - ang
 if(ydef < 0)then
  ang2 = ang2 + 180
 end if
 activate layer lyrNm
 el2 = create line spx spy (spx + 2.55) (spy + .45)
 el2.line.segments[1].pen = "LW_Medium"
 append line segment (spx + 2.5) spy
 el2.line.segments[2].pen = "LW_Medium"
 append line segment (spx + 2.55) (spy - .45)
 el2.line.segments[3].pen = "LW_Medium"
 append line segment spx spy
 el2.line.segments[4].pen = "LW_Medium"
 rotate selection spx spy ang2
 el2.fill = myFill
 SELECT NONE
# Set active pen "LW_Medium"
 Activate Layer "New Raster"
# Zoom extent
# Zoom page
# Set active pen "LW_Medium"
# SELECT NONE
 
End Macro