Skip to main content
1-Visitor
September 17, 2013
Solved

IsoDraw origin location. Editable?

  • September 17, 2013
  • 1 reply
  • 2280 views

Is there a way to change the origin of the IsoDraw drawing field?

Here's my issue:

Whenever I open a .dwg or .cgm (based off of a .dwg) the file is located in the upper-right of the drawing field, with some of the drawing extending beyond the edges of the drawing field. When creating a PDF, all of the info beyond the edges is left out, so that info is essentially lost. Bringing in a PDF or picture, however, does not have this happen and it looks like they align with the center of the IsoDraw field.

I know that I can just select and drag the whole thing so that it fits inside the drawing field, but is there a way to set up IsoDraw so that this happens automatically and/or by default?

See attached picture for reference to placement upon opening the drawing.

Best answer by Dutch_Mn

Here is a macro that I think fits your needs.

It’s a modified version of a macro that I got back in 2006 from the old ITEDO forums

Credit goes to the original author.

global FWidth as float
global FHeight as float
global MoveX as float
global GRP as element
global MoveY as float
global Width as float
global Height as float
global DestWidth as float
global Destheight as float
global ScaleX as float
global ScaleY as float
global Scale as float
global LLpt as point
global ScaledWidth as float
global ScaledHeight as float
global NHFrame as point
global MoveScaledX as float
global MoveScaledY as float


#################

Macro Center all


Select None

Unlock all

# Get and set page Size
FWidth = activeDoc.window.pageX
FHeight = activeDoc.window.pageY


#Select all for Move calculations and create a copy to keep layers (Note: grouping removes layers ... we don't want this)
Select all
Duplicate
Group Selection
GRP = activeDoc.firstSelectedElement

#Determine Image's Width and Height
Width = GRP.box.right - GRP.box.left
Height = GRP.box.top - GRP.box.bottom

#Size of NH Frame in mm

DestWidth = Width
Destheight = Height


#Delete original selection (the copy is still there, copy has layer control which we want)
Delete Selection


#Select all for moving calculations and create a copy to keep layers (Note: grouping removes layers ... we don't want this)
Select all
Duplicate
Group Selection
GRP = activeDoc.firstSelectedElement

#Set Lower Left point (0,0) to move the geometry to
LLpt.x = 0
LLpt.y = 0

#Determine values to move geometry to 0,0
MoveX = -(GRP.box.left-LLpt.x)
MoveY = -(GRP.box.bottom-LLpt.y)


#Delete original selection (the copy is still there, copy has layer control which we want)
Delete Selection

#Move temporarily to 0,0 then will calculate final destination of geometry
Select all
Move selection MoveX MoveY no_Patterns
select none

#Select all for moving calculations and create a copy to keep layers (Note: grouping removes layers ... we don't want this)
Select all
Duplicate
Group Selection
GRP = activeDoc.firstSelectedElement

#Determine Scaled geometry's Width and Height
ScaledWidth = GRP.box.right - GRP.box.left
ScaledHeight = GRP.box.top - GRP.box.bottom

#Set Dimensions (mm) for Center of NH Frame
NHFrame.x = fWidth/2
NHFrame.y = fHeight/2

#Determine the final move values to move the Scaled geometry to the center of the NH Frame
MoveScaledX = (NHFrame.x-(ScaledWidth/2))
MoveScaledY = (NHFrame.y-(ScaledHeight/2))

#Delete original selection (the copy is still there, copy has layer control which we want)
Delete Selection

#Final move to move the Scaled geometry to the center of the NH Frame
Select all
Move selection MoveScaledX MoveScaledY no_Patterns

Select None

Zoom page

End Macro

1 reply

Dutch_Mn1-VisitorAnswer
1-Visitor
September 19, 2013

Here is a macro that I think fits your needs.

It’s a modified version of a macro that I got back in 2006 from the old ITEDO forums

Credit goes to the original author.

global FWidth as float
global FHeight as float
global MoveX as float
global GRP as element
global MoveY as float
global Width as float
global Height as float
global DestWidth as float
global Destheight as float
global ScaleX as float
global ScaleY as float
global Scale as float
global LLpt as point
global ScaledWidth as float
global ScaledHeight as float
global NHFrame as point
global MoveScaledX as float
global MoveScaledY as float


#################

Macro Center all


Select None

Unlock all

# Get and set page Size
FWidth = activeDoc.window.pageX
FHeight = activeDoc.window.pageY


#Select all for Move calculations and create a copy to keep layers (Note: grouping removes layers ... we don't want this)
Select all
Duplicate
Group Selection
GRP = activeDoc.firstSelectedElement

#Determine Image's Width and Height
Width = GRP.box.right - GRP.box.left
Height = GRP.box.top - GRP.box.bottom

#Size of NH Frame in mm

DestWidth = Width
Destheight = Height


#Delete original selection (the copy is still there, copy has layer control which we want)
Delete Selection


#Select all for moving calculations and create a copy to keep layers (Note: grouping removes layers ... we don't want this)
Select all
Duplicate
Group Selection
GRP = activeDoc.firstSelectedElement

#Set Lower Left point (0,0) to move the geometry to
LLpt.x = 0
LLpt.y = 0

#Determine values to move geometry to 0,0
MoveX = -(GRP.box.left-LLpt.x)
MoveY = -(GRP.box.bottom-LLpt.y)


#Delete original selection (the copy is still there, copy has layer control which we want)
Delete Selection

#Move temporarily to 0,0 then will calculate final destination of geometry
Select all
Move selection MoveX MoveY no_Patterns
select none

#Select all for moving calculations and create a copy to keep layers (Note: grouping removes layers ... we don't want this)
Select all
Duplicate
Group Selection
GRP = activeDoc.firstSelectedElement

#Determine Scaled geometry's Width and Height
ScaledWidth = GRP.box.right - GRP.box.left
ScaledHeight = GRP.box.top - GRP.box.bottom

#Set Dimensions (mm) for Center of NH Frame
NHFrame.x = fWidth/2
NHFrame.y = fHeight/2

#Determine the final move values to move the Scaled geometry to the center of the NH Frame
MoveScaledX = (NHFrame.x-(ScaledWidth/2))
MoveScaledY = (NHFrame.y-(ScaledHeight/2))

#Delete original selection (the copy is still there, copy has layer control which we want)
Delete Selection

#Final move to move the Scaled geometry to the center of the NH Frame
Select all
Move selection MoveScaledX MoveScaledY no_Patterns

Select None

Zoom page

End Macro

1-Visitor
September 19, 2013

I set up thise macro as-is and it basically just moved the drawing to the opposite corner with parts still overhanging. I edited the macro so that it would stop after "select none" immediately below "#Move temporarily to 0,0....." and it seems to work.

One other thing to ask: is there a way I can get the macro to run upon opening a .dwg? I.e. create a preference?

12-Amethyst
September 19, 2013

Nothing in the preference file but you can change the shortcut to IsoDraw to include a parameter to kick off the macro on startup. I do this from line command on occasion where the built-in batch tool didn't work the desired way.