+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Forum Newbie
    Using
    Civil 3D 2011
    Join Date
    Dec 2011
    Posts
    3

    Default Layer States and Xref Layer Names

    Registered forum members do not see this ad.

    I am building layer states in Civil 3d 2011 to show all discipline types either within dwg or in xref in VBA. Discipline types will be selected by user ex. V-, C-, D-.
    I can get the ones local by looking at the first two characters in the layer name ex. V-Road-Edge, C-ALIN-CNTR.
    The issue comes with searching for the | character in the xref layer name. ex DGWNAME|V-NODE-UTIL, Thomson|C-TINN.
    Using the INSTR command does not see the character in the xref name. I need to find where in the string it resides. I am using chr(124) to match.
    Any ideas would be appreciated.
    Thanks
    Last edited by DanFHiggins; 6th Dec 2011 at 03:18 pm. Reason: clarification of programming platform

  2. #2
    Luminous Being BlackBox's Avatar
    Computer Details
    BlackBox's Computer Details
    Operating System:
    Windows 8.1 Professional, Server 2012 R2 Datacenter
    Computer:
    Dell Precision T3600
    CPU:
    Hex-Core Intel Xeon 3.2Ghz
    RAM:
    32GB
    Graphics:
    3GB NVIDIA Quadro K4000
    Primary Storage:
    2 x 240GB Samsung EVO SSD (RAID 0)
    Secondary Storage:
    1TB Western Digital VelociRaptor 10K RPM
    Monitor:
    Dual 24" Dell Ultrasharp Widescreen Monitors
    Discipline
    Civil
    BlackBox's Discipline Details
    Occupation
    Senior Civil Designer
    Discipline
    Civil
    Details
    Public/Private Land Development, Transportation, and Utilities.
    Using
    Civil 3D 2016
    Join Date
    Nov 2009
    Posts
    5,282

    Default

    Welcome to CADTutor!

    First, I'd caution you that VBA is on its way out, so you may want to consider jumping to VB.NET if you are adept at coding in VBA (especially for interacting with Civil 3D's Aecc* Objects!). If not adept at coding in VBA, then consider Visual LISP as another option.

    As to your question, consider using the Contains, or InStr Methods, just be sure to test / set the string case using the ToUpper, or ToLower Methods accordingly.

    Untested examples:

    Code:
    Option Explicit
    Public Sub FOO()
        Dim myString as string = "Hello World!"
        Dim keyWord as string = "hello"
        If myString.ToUpper.Contains(keyWord.ToUpper) Then
            ' <-- Do somthing
        Else
            ' <-- Do something else
        End if
    End Sub
    ** Note - I know the Contains Method works in .NET, I am unsure if this is the case for VBA in AutoCAD; you may need to use InStr Method. Please let me know which one works for you.

    Hope this helps (HTH)!
    "Potential has a shelf life." - Margaret Atwood
    AutoCAD, and Civil 3D Certified Professional | Autodesk Authorized Developer
    Sincpac C3D ~ Exchange Apps ~ Autoloader ~ AutoCAD Security

  3. #3
    Forum Newbie
    Using
    Civil 3D 2011
    Join Date
    Dec 2011
    Posts
    3

    Default

    This works giving you the position of the pipe ( | ) character in the string.

    n = InStr(1, la.Name, "|", vbTextCompare)

  4. #4
    Luminous Being BlackBox's Avatar
    Computer Details
    BlackBox's Computer Details
    Operating System:
    Windows 8.1 Professional, Server 2012 R2 Datacenter
    Computer:
    Dell Precision T3600
    CPU:
    Hex-Core Intel Xeon 3.2Ghz
    RAM:
    32GB
    Graphics:
    3GB NVIDIA Quadro K4000
    Primary Storage:
    2 x 240GB Samsung EVO SSD (RAID 0)
    Secondary Storage:
    1TB Western Digital VelociRaptor 10K RPM
    Monitor:
    Dual 24" Dell Ultrasharp Widescreen Monitors
    Discipline
    Civil
    BlackBox's Discipline Details
    Occupation
    Senior Civil Designer
    Discipline
    Civil
    Details
    Public/Private Land Development, Transportation, and Utilities.
    Using
    Civil 3D 2016
    Join Date
    Nov 2009
    Posts
    5,282

    Default

    I'm glad to hear that.

    Out of curiosity, and frankly for my own edification; does the Contains Method work in VBA as it does in VB.NET?
    "Potential has a shelf life." - Margaret Atwood
    AutoCAD, and Civil 3D Certified Professional | Autodesk Authorized Developer
    Sincpac C3D ~ Exchange Apps ~ Autoloader ~ AutoCAD Security

  5. #5
    Forum Newbie
    Using
    Civil 3D 2011
    Join Date
    Dec 2011
    Posts
    3

    Default Oh Well - no Contains in VBA

    Registered forum members do not see this ad.

    No --------

Similar Threads

  1. Xref Layer names
    By omega1227 in forum CAD Management
    Replies: 5
    Last Post: 30th Jul 2010, 04:04 pm
  2. Are layer states available from xref?
    By rayw in forum AutoCAD Drawing Management & Output
    Replies: 9
    Last Post: 12th Mar 2009, 06:22 am
  3. Xref Layer States
    By Schumi in forum AutoCAD General
    Replies: 0
    Last Post: 3rd Feb 2009, 09:20 pm
  4. Autocad LT 2009: X-ref layer states / Layer states manager
    By Mako in forum AutoCAD Drawing Management & Output
    Replies: 0
    Last Post: 6th Nov 2008, 04:24 pm
  5. Xref with layer states
    By yangstein in forum AutoCAD Drawing Management & Output
    Replies: 4
    Last Post: 8th Aug 2008, 10:46 pm

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts