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

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

Fit-Elements

ptc-2059504
1-Newbie

Fit-Elements

Need to create a macro that changes drawing size to 4x8 inches and then "Move" - "Fit-Elements..." then defines a .1in border. Problem: Isodraw will not allow me to provide a Border size as part of the recording feature. It is greyed out. Is there a way to edit the macro to provide this functionality? Thanks, Vince
8 REPLIES 8

The attached macro will resize the current selection to the current frame. The variable BorderSize is set at .1 already which mimics the border function available in the menu. From you post, I want to clarify that the macro language works in mm. Thus, the .1 is of a mm. If you want inches you'll need to change the variable to equal 2.54.
TimSharp
6-Contributor
(To:thendricks)

Your macro is saving us lots of time Trevor. We're getting increasing numbers of iges files to use with CadProcess and each one we convert to 2d and print onto A4 for reference, so authors and illustrators can flick through a hard copy file. I got 123 iges files this morning and each one is converted to 2d, then the page size set to A4, then everything scaled to fit, then the full pathname added so people know where the file is stored. Your Resize_to_Frame_Specify_Border macro is great in the middle of this process. The only thing I find is that some drawings when they are scaled are wider than the drawing sheet and I'm wondering why. I'm not sure of a pattern yet, but it seems to happen on drawings that are similar width to height. I've changed the border to 200 but it still does it with about 1 in 5 or so files - some of them overlap the drawing sheet by quite a bit.

I'm not seeing anything immediately. Can you send me a copy of the modified version you are using? If possible, which I realize it may very well not be possible, can you send me one of the problem files?
TimSharp
6-Contributor
(To:thendricks)

Actually I think I know what the problem is. I guess your macro is written for drawings where the height/width ratio is fairly pronounced. Our iges files come in all shapes and sizes and when one is close in both x and y directions but is still taller than it is wide, your macro uses the height as the scaling factor, which still leaves it too wide. I've attached a simple drawing of a rectangle that shows the problem when the macro is run on it. After a bit of fiddling about, I've added to and replaced a little bit into your macro to cope with our drawings - it seems to work OK, though I've not gone deeply into the logic of it! The bit replaced is commented out at the bottom: 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/(Height+BorderSize) else ScalePercentage = ActiveDoc.window.pageX/(Width+BorderSize) end if # If (Height > Width) then # ScalePercentage = ActiveDoc.window.pageY/(Height+BorderSize) # Else # ScalePercentage = ActiveDoc.window.pageX/(Width+BorderSize) # End If

We have standard a listing of standard frame sizes that we use as you hinted towards. Your catch is correct. I have to admit that I learn as I go. I created a macro a week or two ago that applies a "PROOF" mark to a page before creating a PDF and had to deal with this. I'm assuming from your code that this is being treated as a submacro (perhaps using the extent coding from your other post). Your approach appears correct. The basic idea I used is shown below which appears to be basically what you are doing.
b6008bbe82
TimSharp
6-Contributor
(To:thendricks)

Yes that's basically what I'm doing, though yours is much neater! Yes I'm treating your macro as a sub macro, so thanks very much. I do find the Isodraw Macro language very difficult to follow, being used to ME10's which is completely self-contained and very logical. I guess I should find some sort of guidance for this sort of programming, though I don't even know what it is called! I presume it uses standard programming practices that they haven't bothered to explain in the macro manual.

Unfortunately, as far as I know, the IsoDraw macro language is unique. If you find something that resembles it, let me know know. I've found that the macro help guide is ok, but not robust enough. It also is not current. I had a call in to have a the "Launch" command added at the last rev and it still appears not to be present. Not the only one either.
TimSharp
6-Contributor
(To:thendricks)

I agree about the manual not being enough. If there were more example macros it would help I think. Actually when you said that you think the macro language is unique made me look at the manual again and it finally twigged how the commands work (e.g. element.nextSelectedElement becoming something like myelem.nextSelectedElement when used in a macro). I had thought it was more complicated than it is!
Top Tags