Translate Routine, Again, 3.

Discussion in 'AutoCAD' started by antoniomiranda, Jul 2, 2003.

  1. Hello, in this momment i've one problem.
    it's possible to make one more filter the FilterTyp(x)=0?
    in this momment i've this code:



    ' Select the source entities...
      FilterType(0) = 8
      FilterData(0) = SourceLayer

    FilterType(1) = 62
      FilterData(1) = SourceColor

    FilterType(2) = 6
      FilterData(2) = SourceLineType

    Set SelSet = ThisDrawing.SelectionSets.Add("TranslateEntities")
      SelSet.Select acSelectionSetAll, , , FilterType, FilterData

    ' Change the layer, color, and linetype of each entity selected...
      For Each Entity In SelSet
        Entity.layer = TargetLayer
        Entity.Color = TargetColor
        Entity.LineType = TargetLineType
      Next Entity

    SelSet.Delete



    need to add the filter EntitieType in the source to get a specific element (like blocks), to put them on other layer. If the entities has the propreties ByLayer, this routine don't work, Why???

    Thank's
    António Miranda
     
    antoniomiranda, Jul 2, 2003
    #1
  2. Hi, António:




    Modify the last block as follows:


      



    ' Change the layer, color, and linetype of each entity selected...   For Each Entity In SelSet    If TypeOf Entity Is AcadBlockReference Then    Entity.Layer = BlockLayer    Else      Entity.Layer = TargetLayer     End If     Entity.Color = TargetColor     Entity.LineType = TargetLineType   Next Entity





    You will need to define the variable BlockLayer somewhere. Either build it inside the routine by appending "_block" (or whatever) to the TargetLayer name or you'll need to pass it to the routine as another parameter.




    Example:






    BlockLayer = TargetLayer & "_block"



    Also, don't forget to create the BlockLayer before trying to assign an entity to it. You should also add some error checking / handling code to the above routine if you plan to use it much.

    Sorry, I just don't have the time to write an application for you. As Frank's signature says: "It's more important that you know how to find the answer than to have the answer."
     
    Mark_Abercrombie, Jul 2, 2003
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.