Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Jeff H

Pages: [1]
Blocks / Re: Beginner: Block Insert Redefinition
« on: September 21, 2011, 01:18:11 AM »
ok. see attached. Thanks!

The block i'm using is multiline annotative. the program inserts the wells utilizing an asc well coordinate file.

Sorry I do not see anything attached

Blocks / Re: Beginner: Block Insert Redefinition
« on: September 15, 2011, 05:21:52 AM »
You would have to upload a drawing to look at so I could look at it and maybe see if I can figure out your problem.

You could also look here

.NET newbies / Re: My First Revit Plug-in
« on: August 14, 2011, 10:21:09 AM »
Looks like they are creating one

We currently have guides for Maya and AutoCAD in the works. While many of this blog’s readership won’t need this kind of assistance, I think many will enjoy what Stephen Preston is cooking up for AutoCAD. ;-)

Blocks / Re: Beginner: Block Insert Redefinition
« on: August 12, 2011, 09:36:35 PM »
I was having a little trouble follwing it needs to be updated but if it is working for you then great.

I guess it must be the InsertBlock function causing trouble.

around line 358 try this and see if it helps.

Code: [Select]
            Dim myblockdef As BlockTableRecord = _

Code: [Select]
            Dim myblockdef As BlockTableRecord = _
            myblockdef.Annotative = AnnotativeStates.True

change OpenMode to ForWrite and add following line

Blocks / Re: Beginner: Block Insert Redefinition
« on: August 11, 2011, 09:58:08 AM »
Sorry from a external drawing.

Are yoou inserting the whole drawing or a block from the drawing?

Do have a example of what you have so far?

Blocks / Re: Beginner: Block Insert Redefinition
« on: August 03, 2011, 02:59:45 PM »
Take a look at

and notice the part
Code: [Select]
            If btr.Annotative = AnnotativeStates.True Then
                Dim ocm As ObjectContextManager = db.ObjectContextManager
                Dim occ As ObjectContextCollection = ocm.GetContextCollection("ACDB_ANNOTATIONSCALES")
                ObjectContexts.AddContext(bref, occ.CurrentContext)
            End If

Blocks / Re: Erase doubled block references
« on: November 25, 2010, 10:15:46 AM »
MyBase is the same as C# Base

If a class inherits from a class it can use MyBase to call methods from the class it inherits from.

Here is a simple console App that overrides the the base class MessageBox method then calls the base class MessageBox method

Code: [Select]
Module Module1

    Sub Main()
        Dim a As New InheritsBaseClass

    End Sub

End Module
Public Class BaseClass

    Public Overridable Sub MessageBox()
        MsgBox("Base Class")
    End Sub

End Class

Public Class InheritsBaseClass : Inherits BaseClass

    Public Overrides Sub MessageBox()
        MsgBox("Derived Class")
    End Sub

    Public Sub MessageBoxBase()

    End Sub

End Class

Layouts and printing / Re: Get the current layout
« on: November 24, 2010, 03:11:11 PM »
I would get Gile's input also, but I would dispose the transaction in the catch block and commit the after End Try.
So if you have an error you dispose if not you commit.
And not worry about the finally block.

I am about to run out to the field, so later today or this weekend I will double check this but,
If you use Transaction.GetObject then try to pass to the caller which is inside a transaction you might get an error. Do not quote me on that I on going off of memory

Layouts and printing / Re: Create and copy Layouts?
« on: November 24, 2010, 03:00:09 PM »
Here is a simple VB & C# example of copying a layout from a external drawing,
There is no error handling or checking if the drawing, layout exist to keep it short.

This is pretty much the same as copying the PlotSettings or the "Page Setup"
You must have a drawing and layout named the same or change it.

A simple App example would let the user select a location or drawing where they setup all the different "Page Setups" from a context menu or something similiar. Then you could fill a listbox or whatever with the names on a palette, and on the click event bring in the copy the layout.
This example is hard-coded for simplicity


Code: [Select]
        public static void CopyExternalLayout()
            Database db = HostApplicationServices.WorkingDatabase;
            Database stdDb = new Database();
            stdDb.ReadDwgFile(@"C:\Test\PageSetup.dwg", FileOpenMode.OpenForReadAndAllShare, false,"");

            using (Transaction trx = db.TransactionManager.StartTransaction())
            using (Transaction stdTrx = stdDb.TransactionManager.StartTransaction())
                DBDictionary stdLayoutDictionary = stdDb.LayoutDictionaryId.GetObject(OpenMode.ForRead) as DBDictionary;
                Layout stdLayout = stdLayoutDictionary.GetAt("TestPageSetUp").GetObject(OpenMode.ForRead) as Layout;
                BlockTableRecord paperSpace = SymbolUtilityServices.GetBlockPaperSpaceId(db).GetObject(OpenMode.ForRead) as BlockTableRecord;
                Layout layout = paperSpace.LayoutId.GetObject(OpenMode.ForWrite) as Layout;


Code: [Select]
<CommandMethod("CopyExternalLayout")> _
    Public Shared Sub CopyExternalLayout()

        Dim db As Database = HostApplicationServices.WorkingDatabase
        Dim stdDb As Database = New Database()
        stdDb.ReadDwgFile("C:\Test\PageSetup.dwg", FileOpenMode.OpenForReadAndAllShare, False, "")

        Using trx As Transaction = db.TransactionManager.StartTransaction()
            Using stdTrx As Transaction = stdDb.TransactionManager.StartTransaction()

                Dim stdLayoutDictionary As DBDictionary = stdDb.LayoutDictionaryId.GetObject(OpenMode.ForRead)
                Dim stdLayout As Layout = stdLayoutDictionary.GetAt("TestPageSetUp").GetObject(OpenMode.ForRead)
                Dim paperspace As BlockTableRecord = SymbolUtilityServices.GetBlockPaperSpaceId(db).GetObject(OpenMode.ForRead)
                Dim layout As Layout = paperspace.LayoutId.GetObject(OpenMode.ForWrite)

            End Using


        End Using

    End Sub

Layouts and printing / Re: Get the current layout
« on: November 24, 2010, 04:44:22 AM »
It is quicker to call Transaction.Commit and if you have an error you are calling Abort and Dispose on the transaction.
Another thing to consider is nested transactions when you commit a transaction that is nested it passes up the objects to the containing transaction, but in with the finally statement it will be disposed.

Pages: [1]