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

How to trim IsoDraw illustration outside vdc extent

bfriesen
16-Pearl

How to trim IsoDraw illustration outside vdc extent

Hello all, we are placing jt files on our templates. We resize and contour fill until it looks correct. We then export to a cgm. We have been having some issue with excessive file size due to all the information outside the vdc extent also converts. We have set editor to not to display anything outside this vdc extext, but the cgm are being quite large slowing down publishing. What we have been doing to alleviate this, is create a box filled with a color then place it over the excess illustration outside the template. Select element, optimize, remove covered elements. Then it removes anything that is covered. We do have a frame around our template. Is there away to automate this procedure?

Bryon

16 REPLIES 16

I'm having similar issues.

Importing IGS-files and exporting to PDF, resulting in files up till 50MB! It's har to email such files

I started a case in PTC via my service provider and are waiting with my breath held back.

Jens

If you create a box with fill, place it over the object outside the hatched pattern (VDC extent). From the menu, choose optimize remove covered elements. This will remove anything under the box with fill. Note if you don't lock the other layers it will also remove content from those other layers. There has to be away to automate this.

Thanks

Bryon

PS if you go to edit preferences, pdf export, advanced, you can make changes to the file that is being exported. You might try changing the default color image to grayscale or lineart.

Can one of you provide a sample file with some generic art to demonstrate the issue? Might be able to look at some automation but I want to make sure I'm hitting the right issue.

Here is a bolt shown in example. I have used the block method and removed the lines outside the hatching in example_2.

Thanks

Bryon

Try the attached macro. It applies a mask and then exports the CGM to the same folder as the IDR is currently in.

Hi Trevor, thanks for the macro. It does crop the image to the frame with ease. The issues that I see with the macro are that I cannot go back to 3D, and it moves the cropped image off the layer it was imported to and places it on the illustration number layer.

Another method we have used is to duplicate the frame, then create another box over the hatched box that encompasses all the model that is outside the hatch pattern. Select both boxes and create a compound path, then place a fill on the new compound box and then remove the covered elements. This maintains the ability to go back to 3D and keeps imported models on there respective layers.

Thanks

Bryon

Does the base functionality suit your needs? By that, I mean is the output what you desired? If so, for another purpose I did a hack. Outline of the idea is below.

  1. Run macro
  2. Macros saves file
  3. Runs what you see in the current file.
  4. Closes file without saving
  5. Reopens saved version that contains the 3D version

Yes the base functionality does what I would like it to do, crop anything outside the hatched area. We currently have another macro that we run to export the image. First it saves the file, then exports a jpg version and a CGM version to the required folder locations. This macro will change a bit as we are implementing the Simonsoft CMS. Not sure where the cgm will need to be saved. For our needs if the macro can crop to the extent of the frame leaving the items on there respective layers and have the ability to convert back to 3D would be great.

Thanks

Bryon

Here's an updated version. It now follows the logic I mentioned. I also put a couple commented out options for the export.

In regards to the layering, is the problem that the CGM has the art on the wrong layer or is it a problem that the original file was modified like that? If the latter this should address it. If it is the former it would be a bit more complex but the macro could be modified to loop through each layer and apply the mask.

Thanks Trevor, We have some really large jt files, so the re opening of the file would not be practicable. It seems that the mask feature is joining the image and outer frame together. We can have multiple layers with different content on each layer. Is there a way to replicate the remove covered elements instead of using the mask. I have attached two videos showing the difference. In the remove elements you can still convert back to 3d if required. Using the remove elements also cuts through all the layers.

Thanks

Bryon

Hello Trevor back trying to get your script to work the way I would like. I have a little more understanding know of what it is doing. The script below almost works as I would like it to. We have an existing frame on our illustration layer, which is why when it does the trim it leaves it on the illustration layer.

Macro trim idr

#Define variables.

    Define FR as Float

    Define FT as Float

    Define el as Element

    Define IamHere as String

    Define Path as String

#Grabs current file location and saves.  

    IamHere = ActiveDoc.Path

    Save IamHere

  

#Determines frame extent.

    FR = ActiveDoc.window.pageX

    FT = ActiveDoc.window.pageY

#Creates temporary rectangle the same dimensions of frame.

    Create Rectangle 0 0 FR 0 FR FT 0 FT

    el = activeDoc.firstSelectedElement (when this creates the rectangle, what layer would it be on, on our template it seems to be on the illustraion layer, how do I get it to be on the raster layer, then hide the illustration layer so it does not use the frame that is there already)

    Create Object_Info el

    Create Object_Attribute "Flag" "String" el

    el.info.attributes["Flag"].value = "Temp"

#Select everything but temporary rectangle.

    Select If Object_Attribute is not equal to "Flag"

#Mask content based on temporary rectangle.

    Mask at FR FT

(show the illustration layer again)

#Clear selection prior to export (duplicate function call to be safe).

    Select None

    Select None

  

End Macro

Thanks

Bryon

Right before you create the rectangle insert the following line. This assumes the layer you want is literally called 'raster' so I'm sure you'll need to change that.

     Activate Layer "raster"

This then changes the active layer to "raster" before you draw the object.

As for the illustration layer and suppressing it's export...

     ActiveDoc.Layers["LayerName"].Exportable = False

     Export...

     ActiveDoc.Layers[LayerName].Exportable = True

Thanks Trevor, that did not do what I had hoped it would. After it does the mask how do I keep the image on the layer the object was initially placed on. Once the object is masked the object ends up on the illustration number layer instead of the Raster layer where it was initially placed. I changed the macro to copy the frame on the Illustration number layer and paste it to the Raster later hoping it would use the frame on that layer, but it does not.

Macro trim idr

#Define variables.

    Define FR as Float

    Define FT as Float

    Define el as Element

    Define IamHere as String

    Define Path as String

#Grabs current file location and saves.   

    IamHere = ActiveDoc.Path

    Save IamHere

   

#Determines frame extent.

    FR = ActiveDoc.window.pageX

    FT = ActiveDoc.window.pageY

  

#Creates temporary rectangle the same dimensions of frame.

    Create Rectangle 0 0 FR 0 FR FT 0 FT

    el = activeDoc.firstSelectedElement

    Create Object_Info el

    Create Object_Attribute "Flag" "String" el

    el.info.attributes["Flag"].value = "Temp"

    copy

    Activate layer "Raster"

    Paste same_Position

#Select everything but temporary rectangle.

    Select If Object_Attribute is not equal to "Flag"

#Mask content based on temporary rectangle.

    Mask at FR FT

#Clear selection prior to export (duplicate function call to be safe).

    Select None

    Select None

End Macro

Thanks Bryon

Move the  - Activate layer "Raster" - line up above the Create Rectangle line. Right now you're creating the rectangle on whatever layer it happened to be on when you started the macro.

Video Link : 7528 Thanks Trevor, I tried moving the activate layer, still no go. The file opens with the raster layer active. Once the mask is applied it moves the image to the illustration layer. See attached video.

Bryon

Haven't gotten to look into this further but my suggestion then would be to select the contents of one or all of the layers, loop through and put a flag (meta tag) on each identifying it's layer. You can then apply the mask and when done do a select if command to move the sections back to their original layers. Flag could always be deleted when done to be clean.

Top Tags