Recent Posts

Pages: [1] 2 3 ... 10
.NET / Re: Forms.DataGridView.Column Reorder
« Last post by owenwengerd on Today at 07:42:11 pm »
I think you should consider changing your strategy. Instead of "display order", think of it as "rank". Save a given column's rank ("rank" could be it's current position, or some arbitrary value that expresses an ordering relative to all other columns currently displayed), then upon the next initialization just take whatever columns you happen to have and order them by rank, with columns of equal rank falling back on alphabetic ordering (or whatever works), and columns with no rank getting tacked on the end. Then let the user rank their columns however they choose with no restrictions.
.NET / Re: Forms.DataGridView.Column Reorder
« Last post by Jeff_M on Today at 06:54:02 pm »
Thanks, Luis. That is essentially what I have done up until now with my static 18 column DGV. But once I add new columns, say 5 this time, and change the display of one of the original to be at displayorder 20. Then the next time this form is used in another drawing that may only need the original 18 columns, when restoring the display order for the item at position 20 it will fail since that is now an invalid position. Plus there will also be 5 additional saved positions that cannot be applied since those columns do not exist.
.NET / Re: Forms.DataGridView.Column Reorder
« Last post by LE on Today at 06:40:15 pm »

The DataGridView shipped with the framework allows the user to reorder the columns but there is nothing to persist the new column order.
.NET / Forms.DataGridView.Column Reorder
« Last post by Jeff_M on Today at 06:12:59 pm »
I'm a bit stumped with this. I have a form with a DataGridView (DGV) which has 18 static columns. I currently allow the user to reorder them to any other location in the DGV and I save the new order for future use. I'm now expanding this DGV to include columns that can vary in number and names. I'd like to still allow the reordering/saving of the original 18 columns, while preventing any additional columns from doing so. Including not allowing any of the original 18 to be placed in columns 18+. What I have thus far been able to do, using the DGV MouseDown event, is determine if the left button has clicked on one of the new columns and, if so, turn off the DGV's AllowUserToOrderColumns property and then turn it back on with the MouseUp event. This works to keep the new ones from being moved around, but I'm not finding a way to prevent the others from being moved into the new columns area.

In summarry, DGV.Columns 0-17 display order should be able to change to any DisplayLocation 0-17. DGV.Columns 18+ display order cannot change at all.

Is what I'm trying to accomplish even possible? A Google search sure hasn't turned up anything like this.
.NET / Re: Collapsing Xrefs
« Last post by Bashworth on Today at 06:02:31 pm »
Etransmit won't work if any of the xrefs are unloaded.

The clients want it all in one single DWG.
.NET / Re: Collapsing Xrefs
« Last post by Jeff H on Today at 05:34:40 pm »
Why not just etransmit and use insert and purge option?
VB(A) / Re: Excel VBA send autocad commands
« Last post by Bashworth on Today at 04:31:29 pm »
If you just want to dump stuff onto an AutoCAD command line, you could just use:

(variable holding the active drawing).SendCommand

What information is in the XML file that you are wanting to use in AutoCAD?
.NET / Collapsing Xrefs
« Last post by Bashworth on Today at 04:24:54 pm »
Hello all.  Long time no see for many of you.  Probably hello for the first time for most of you.

I have been out of the AutoCAD development (or any development) game for a number of years, and trying to knock the rust off.

I have a series of drawings that rely heavily on xrefs, many many nested tiers.  Options that I need to display are controlled via loading and unloading some of these nested and parent xrefs.

From time to time, we get a request to send the .DWG version of a file to a client.

I had a routine in VBA that would go through, gather a list of the names of all the loaded xrefs, then load all xrefs, bind, explode, and delete the blocks named according to the previously unloaded xrefs.  It worked alright, but since we're in 64bit land, it's SLOOOOWWWWWWWW.. Sometimes taking 10-15 minutes to run.   Granted, some of that is my fault.  It's ugly code, but I don't have the time to sit down and really pour a lot of effort into organizing it better, when I'd rather just scrap VBA all together.

I'm trying to work this into a .Net solution, and I'm struggling with the lack of documentation for how to accomplish what I'm doing.

I got some code, which returns to me the names of the loaded and unloaded PARENT xrefs, but isn't giving me the nested ones.

I'm primarily working in VB.Net, but I have several converters for C# to VB.Net as well.

I'm using AutoCAD 2013, and Visual Studio Express 2010 as my IDE.

Any pointers would be great, and thanks in advance.

Here's what I have so far:
Code: [Select]
Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.Geometry
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.EditorInput

Namespace GADWGCollapser

    Public Class Commands

        'define the command
        Public Shared Sub GetListOfXrefs()
            Dim doc As Document =
            Dim db As Database =
            Dim xg As XrefGraph =
            Dim root As GraphNode =
            Dim ed As Editor =
            Dim xrUnLoaded As New List(Of String)
            Dim xrLoaded As New List(Of String)
            Dim xrParents As New List(Of String)

            'Iterate through all xrefs in drawing
            For n As Integer = 0 To root.NumOut - 1
                Dim child As XrefGraphNode =
                    TryCast(root.Out(n), XrefGraphNode)

                'Discover if this is a parent xref, used for later binding and exploding
                If child.IsNested = False Then
                    'just for testing, comment the following line out prior to completion
                    ed.WriteMessage("Parent " + child.Name + vbLf)
                End If

                'Determine if the xref is loaded, or unloaded
                'Only loaded xrefs should be kept later, after
                'binding and converting to a block
                If child.XrefStatus = XrefStatus.Resolved Then
                    'just for testing, comment the following line out prior to completion
                    ed.WriteMessage("Loaded " + child.Name + vbLf)
                ElseIf child.XrefStatus = XrefStatus.Unloaded Then
                    'just for testing, comment the following line out prior to completion
                    ed.WriteMessage("Unloaded " + child.Name + vbLf)
                End If
        End Sub
    End Class
End Namespace
.NET / Re: Selection set - get single block loop thru
« Last post by jcoon on Today at 12:03:24 pm »

I'll convert and test tonight.  I never used SetImpliedSelection before, thought it was something that I'd like to add to a few of my routines. thank you.  You learn something everyday reading these posts

The convertor screwed up on linq expression and instead of looking at VB linq syntax just change to

Code - Visual Basic: [Select]
  1.    Private Shared Function DecryptFile(bytes As IEnumerable(Of Byte)) As Byte()
  2.        Dim list = New List(Of Byte)()
  3.        For Each b As Byte In bytes
  4.            list.Add(decode(b))
  5.        Next
  7.        Return list.ToArray()
  8.    End Function
Pages: [1] 2 3 ... 10