TurboCAD Forums

The Ultimate Resource for TurboCAD Knowledge

Be sure your post is relevant to the current discussion.  Create a new topic within the appropriate board if you are unsure.

InsetFile second parameter / too many paper spaces created
Read 5904 times
* August 11, 2010, 01:15:31 AM
Does anybody know what is the meaning of the second parameter of the Drawing.InsetFile?
When I leave it missing, on inserting SAT a new paper space tab is created. When I pass True, it's usually not created, but sometime it is (of course, it could be a side effect of some further code, but this is the only obvious point).
The function isn't documented (TCad17 nor 16 tcsdk.chm), but it's visible in the interface.
I doubt that the meaning of the second parameter should be "create paper space".

Did anyone got a side effect of paper space creation in different functions?


* August 12, 2010, 03:11:39 AM
There is one more side effect of the second parameter of Drawing.InsertFile. If it's true, than workplane is switched to default one (XY == top).
So either paper space is created or workplane is switched. Is it a bit field?


* August 12, 2010, 05:16:46 AM
Doesn't seem to be a bit field:
0 and False keep workplane, but create paper tab;
True, 1, 2 and 1024 reset workplane and don't create paper tab.


* August 12, 2010, 10:54:30 AM
Sorry for the late reply.

The second parameter is a boolean, and corresponds to the "override data" checkbox in the Insert File dialog box. If this is set to True, some data in the host drawing may be overwritten by data in the inserted drawing. Also, your original paperspace may be replaced by the default paperspace in the file being inserted. If it is set to False, a new paperspace is added (perhaps more than one if the drawing being inserted contains multiple paperspace layouts).

I'm not seeing the workplane switch that you describe -- could it perhaps be related to your AutoWorkplane setting?

Since it's not entirely clear what data may be overridden if you set the second parameter to True, I recommend leaving it at False.

A procedure that seems to work for me is this:
1) Store the current UCS
2) Store the current Paperspace count
3) InsertFile(filename, False)
4) Get the new Paperspace count, and delete any new acquisitions.
5) Restore the original UCS.

I am attaching a zipped VBScript and some sample drawings to illustrate.
InsertFileHost.tcw is the file you want to have loaded when you run the script.
Mesh5x8 is just a "dummy" sample drawing to insert using InsertFile.


* August 13, 2010, 04:05:40 AM
Seems to work. Thank you very much.

Just few comments:
. ) The Paperspaces.Delete must not be inside open UndoRecord. I do some manipulations with the inserted file, so I create the UndoRecord (Drawing.AddUndoRecord) after InsertFile.

.) In your example:
Instead of
  Dim i
  Dim j
  j = newcount - spacecount
  For i = 0 To j-1
    spaces.Item(spacecount + i).Delete

I suggest to use
  For i = j-1 to 0 step -1


October 04, 2011, 06:12:40 PM
Sorry cannot help you.
I just came in for support.
hope you can find what you want earlier.