AcadX-DocumentIterator

AcadX-DocumentIterator

Anonymous
Not applicable
351 Views
4 Replies
Message 1 of 5

AcadX-DocumentIterator

Anonymous
Not applicable
Hi NG;

I've been trying the great plugin from Tony T AcadX.
The AcadXDynamicGraphics works perfect but I have
problem with the DocumentIterator.
What i want to accomplish is to change the font of a textstyle
within a large number of drawings but it doesn't seem to
save the changes.

Thisdrawing.Save doesn't return an error so i don't know
what it could be.

Any ideas? See code below.

Thanks


Private Sub Iterator_OpenDocument(Document As AXDB15Lib.IAxDbDocument)

Dim txtStyle As AcadTextStyle

ThisDrawing.Utility.Prompt vbCrLf & "Processing " & Document.Name

On Error GoTo Slutet
Set txtStyle = ThisDrawing.TextStyles.Item("Normal")
txtStyle.fontFile = "C:/AutoCAD/Fonts/iso.shx"

Err.Clear
ThisDrawing.Save

MsgBox Err.Description

Slutet:
Set txtStyle = Nothing

End Sub
0 Likes
352 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
Nevermind found the Document.SaveAs (Document.Name) method.
But do you have any ideas why the change of the fontfile to the
TextStyle isn't saved.


"David" skrev i meddelandet
news:38852EBFC96265FE4A6D06F0717547C8@in.WebX.maYIadrTaRb...
> Hi NG;
>
> I've been trying the great plugin from Tony T AcadX.
> The AcadXDynamicGraphics works perfect but I have
> problem with the DocumentIterator.
> What i want to accomplish is to change the font of a textstyle
> within a large number of drawings but it doesn't seem to
> save the changes.
>
> Thisdrawing.Save doesn't return an error so i don't know
> what it could be.
>
> Any ideas? See code below.
>
> Thanks
>
>
> Private Sub Iterator_OpenDocument(Document As AXDB15Lib.IAxDbDocument)
>
> Dim txtStyle As AcadTextStyle
>
> ThisDrawing.Utility.Prompt vbCrLf & "Processing " & Document.Name
>
> On Error GoTo Slutet
> Set txtStyle = ThisDrawing.TextStyles.Item("Normal")
> txtStyle.fontFile = "C:/AutoCAD/Fonts/iso.shx"
>
> Err.Clear
> ThisDrawing.Save
>
> MsgBox Err.Description
>
> Slutet:
> Set txtStyle = Nothing
>
> End Sub
>
>
0 Likes
Message 3 of 5

Anonymous
Not applicable
David - After processing a drawing with the document
iterator, open it in the drawing editor, and try grip
editing some text whose style was changed, and let me
know if the text updates to the new font.

"David" wrote in message news:2EF74139C4F43476604B555F101DB3EF@in.WebX.maYIadrTaRb...
> Nevermind found the Document.SaveAs (Document.Name) method.
> But do you have any ideas why the change of the fontfile to the
> TextStyle isn't saved.
>
>
0 Likes
Message 4 of 5

Anonymous
Not applicable
Hi Tony;

I did work out when I replaced Thisdrawing.Textstyles with
Document.Textstyles.
See code below
I think I saw you mention it in this NG somewhere that ThisDrawing might not
work.
But ThisDrawing.Utility.Prompt works fine so there is something strange.

Thanks for a great program/plugin for ACAD

Private Sub Iterator_OpenDocument(Document As AXDB15Lib.IAxDbDocument)

Dim txtStyle As AcadTextStyle
ThisDrawing.Utility.Prompt vbCrLf & "Processing " & Document.Name

On Error GoTo Slutet
Set txtStyle = Document.TextStyles.Item("Normal")

txtStyle.fontFile = "C:/AutoCAD/Fonts/iso.shx"

Err.Clear
Document.SaveAs (Document.Name)

Slutet:

Set txtStyle = Nothing

End Sub

"Tony Tanzillo" skrev i meddelandet
news:021017CE1834376247A5A61E2432855F@in.WebX.maYIadrTaRb...
> David - After processing a drawing with the document
> iterator, open it in the drawing editor, and try grip
> editing some text whose style was changed, and let me
> know if the text updates to the new font.
>
> "David" wrote in message
news:2EF74139C4F43476604B555F101DB3EF@in.WebX.maYIadrTaRb...
> > Nevermind found the Document.SaveAs (Document.Name) method.
> > But do you have any ideas why the change of the fontfile to the
> > TextStyle isn't saved.
> >
> >
>
>
0 Likes
Message 5 of 5

Anonymous
Not applicable
Sorry, I should have spotted that.

In the OpenDocument event handler, the Document
parameter is the AutoCAD drawing that is being
processed, so that's what you must use.

ThisDrawing is the AutoCAD drawing that's currently
open and active in the drawing editor, which has
nothing to do with the drawings that you are processing
using the Document Iterator.

ThisDrawing.Utility.Prompt is for displaying
messages on the command line, and that will
work, but for accessing the drawing that is
currently being processed, you always use the
Document parameter of the OpenDocument event
handler.

"David" wrote in message news:444A88C3EAADAF4D794A2297E42222B7@in.WebX.maYIadrTaRb...
> Hi Tony;
>
> I did work out when I replaced Thisdrawing.Textstyles with
> Document.Textstyles.
> See code below
> I think I saw you mention it in this NG somewhere that ThisDrawing might not
> work.
> But ThisDrawing.Utility.Prompt works fine so there is something strange.
>
> Thanks for a great program/plugin for ACAD
>
> Private Sub Iterator_OpenDocument(Document As AXDB15Lib.IAxDbDocument)
>
> Dim txtStyle As AcadTextStyle
> ThisDrawing.Utility.Prompt vbCrLf & "Processing " & Document.Name
>
> On Error GoTo Slutet
> Set txtStyle = Document.TextStyles.Item("Normal")
>
> txtStyle.fontFile = "C:/AutoCAD/Fonts/iso.shx"
>
> Err.Clear
> Document.SaveAs (Document.Name)
>
> Slutet:
>
> Set txtStyle = Nothing
>
> End Sub
>
> "Tony Tanzillo" skrev i meddelandet
> news:021017CE1834376247A5A61E2432855F@in.WebX.maYIadrTaRb...
> > David - After processing a drawing with the document
> > iterator, open it in the drawing editor, and try grip
> > editing some text whose style was changed, and let me
> > know if the text updates to the new font.
> >
> > "David" wrote in message
> news:2EF74139C4F43476604B555F101DB3EF@in.WebX.maYIadrTaRb...
> > > Nevermind found the Document.SaveAs (Document.Name) method.
> > > But do you have any ideas why the change of the fontfile to the
> > > TextStyle isn't saved.
> > >
> > >
> >
> >
>
>
0 Likes