Author Topic: Combining multiple blocks and renaming group block  (Read 6920 times)

0 Members and 1 Guest are viewing this topic.

ELOQUINTET

  • Guest
Combining multiple blocks and renaming group block
« on: April 16, 2008, 10:41:31 AM »
Hey guys,

I am having to take existing blocks and combine them to form an assembly block. The name of the assembly block will be sort of a combination of the 2 blocks and I'm trying to see if I can automate this process to eliminate typing errors. I have attached a sample drawing which goes into more detail about the process involved. I have about 300 blocks I currently need to do this for and this is a main part of my job so I'd like to streamline it if at all possible. Take a look and tell me if it's feasible. Thanks

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Combining multiple blocks and renaming group block
« Reply #1 on: April 16, 2008, 01:23:34 PM »
Dan, The side blocks PK-07.62B3_L do not have the text as part of the block but the combined block does.
Was that you intent to select the mtext objects as well?

Pseudo Code
Code: [Select]
Select main block
Selection: Select blocks & text, should include main block
Create name
Verify block name
Select insert point
Make new combo block
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

ELOQUINTET

  • Guest
Re: Combining multiple blocks and renaming group block
« Reply #2 on: April 16, 2008, 01:40:25 PM »
Yes CAB the text is intentionally not a part of the nested block in order to not have to have a left and right block with different labels so I would need to select the text as well.

ELOQUINTET

  • Guest
Re: Combining multiple blocks and renaming group block
« Reply #3 on: April 16, 2008, 01:56:37 PM »
Hey CAB another thing I discovered after I posted this is that the middle case will have a suffix (_M) that will need to be stripped off as was the case with the _LR

ELOQUINTET

  • Guest
Re: Combining multiple blocks and renaming group block
« Reply #4 on: April 16, 2008, 02:53:16 PM »
CAB how much harder would it be to allow the user to specify what part of string they need to strip off or replace. I haven't been doing this job that long but I think the block naming strategy and could vary slightly depending on how many options we have so it would be nice to eventually be able to input whatever info i need to strip or replace.

ELOQUINTET

  • Guest
Re: Combining multiple blocks and renaming group block
« Reply #5 on: April 18, 2008, 09:07:12 AM »
I'm guessing I will have to do this manually, for now at least as it is time to actually do it. This is going to be a long day  :|

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Combining multiple blocks and renaming group block
« Reply #6 on: April 18, 2008, 10:03:01 AM »
Dan,

I looked at your example but could not follow exactly what you wanted.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

ELOQUINTET

  • Guest
Re: Combining multiple blocks and renaming group block
« Reply #7 on: April 18, 2008, 01:30:50 PM »
Hmmm what part didn't you understand. I know it's not real straight forward but I thought I explained it pretty well. Basically I need to combine all three blocks into a group block and this group blocks name will consist of the mentioned parts from each of it's nested block names. Let me know what doesn't make sense and I'll try to spell it out better. Attached are a couple of files which may paint the bigger picture of what I'm doing.


CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Combining multiple blocks and renaming group block
« Reply #8 on: April 18, 2008, 04:13:03 PM »
Per the pseudo code and No error checking.
Code: [Select]
;;  Combo Block.lsp
(defun c:cblock (/ bent bname bname2  pos pt ss)
  (setvar "clayer" "0")
  (if
    (and
      (setq bent (entsel "\nSelect main block for name."))
      (setq bname (cdr (assoc 2 (entget (car bent))))
            bname (strcase bname)
            bname (vl-string-subst "GROUP_" "_" bname)
      )
      (setq bent2 (entsel "\nSelect sub block for name."))
      (setq bname2 (cdr (assoc 2 (entget (car bent2))))
            bname2 (strcase bname2)
            pos    (vl-string-position (ascii ".") bname2)
            bname2 (substr bname2 (+ pos 2))
            pos    (vl-string-position (ascii "_") bname2)
            bname2 (substr bname2 1 pos)
            bname  (strcat bname "_" bname2)
      )
      (princ "\nSelect objects to makup the new block.")
      (setq ss (ssget))
      (setq pt (getpoint "\nPick Insert point."))
    )
     (command "-block" bname "non" pt ss "" "-insert" bname "non" pt "" "" ""
             )
  )
  (princ)
)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

ELOQUINTET

  • Guest
Re: Combining multiple blocks and renaming group block
« Reply #9 on: April 18, 2008, 05:26:22 PM »
Oh CAB you are OOOO so close and probably would have nailed it right on the head if I would have conveyed some info I forgot I needed after I posted the example. The only 2 problems I have is that the prefix ELEVGROUP needs to be lowercase as it is in the example. The second part is what I forgot to mention and that is that the first block will now have an _M at the end of the name but I assume it can be stripped in a similar way that the _LR was. Oh CAB did I ever tell you that you amaze me, I'm sure I have but I'll say it again. You have made my week, Virtual Beer on me.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Combining multiple blocks and renaming group block
« Reply #10 on: April 18, 2008, 05:39:49 PM »
How's this?
Code: [Select]
(defun c:cblock (/ bent bname bname2  pos pt ss)
  (setvar "clayer" "0")
  (if
    (and
      (setq bent (entsel "\nSelect main block for name."))
      (setq bname (cdr (assoc 2 (entget (car bent))))
            ;; bname (strcase bname)
            bname (vl-string-subst "elevgroup_" "elev_" bname)
            bname (vl-string-subst "" "_M" bname)
      )
      (setq bent2 (entsel "\nSelect sub block for name."))
      (setq bname2 (cdr (assoc 2 (entget (car bent2))))
            bname2 (strcase bname2)
            pos    (vl-string-position (ascii ".") bname2)
            bname2 (substr bname2 (+ pos 2))
            pos    (vl-string-position (ascii "_") bname2)
            bname2 (substr bname2 1 pos)
            bname  (strcat bname "_" bname2)
      )
      (princ "\nSelect objects to makup the new block.")
      (setq ss (ssget))
      (setq pt (getpoint "\nPick Insert point."))
    )
     (command "-block" bname "non" pt ss ""
              "-insert" bname "non" pt "" "" "")
  )
  (princ)
)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

ELOQUINTET

  • Guest
Re: Combining multiple blocks and renaming group block
« Reply #11 on: April 19, 2008, 09:13:28 AM »
I'll have to test it on Monday CAB but will let you know. Thanks again for your help.

ELOQUINTET

  • Guest
Re: Combining multiple blocks and renaming group block
« Reply #12 on: April 21, 2008, 09:25:41 AM »
CAB this works perfectly thank you so much this saves me alot of time and will cut down alot of errors.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Combining multiple blocks and renaming group block
« Reply #13 on: April 21, 2008, 10:14:58 AM »
You're welcome.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

ELOQUINTET

  • Guest
Re: Combining multiple blocks and renaming group block
« Reply #14 on: April 21, 2008, 11:42:53 AM »
CAB sorry about this but I found something and again this is probably my fault for not clarifying. I was just reviewing my notes from the meeting with my boss and the format is missing something. It turns out I also need to replace the dot from the first block with an underscore so from the example I gave you the code should read:

elevgroup_PK-07_60BBB3_62B3

not

elevgroup_PK-07.60BBB3_62B3

I was trying to figure it out but there's alot of substitution going on in there. Gimme a hint  :ugly:

ELOQUINTET

  • Guest
Re: Combining multiple blocks and renaming group block
« Reply #15 on: April 21, 2008, 11:48:03 AM »
Nevermind I got it. I added this into the bname part.

Code: [Select]
bname (vl-string-subst "_" "." bname)

ELOQUINTET

  • Guest
Re: Combining multiple blocks and renaming group block
« Reply #16 on: April 22, 2008, 03:11:12 PM »
Hey CAB The routine I requested from you is what I am using to create my elevation group blocks. I thought I would be able to modify the code to work with my plan blocks but there are a few differences I'm not sure how to deal with.:

1) I have 3 blocks and instead of containing text they contain attributes
2) I have the left side and right as blocks so that I can extract the attributes for cost reports

I figured these changes out:

3) The layer is different
4) The prefixes have changed from elev_ and elevgroup_ to plan_ and plangroup_

I'm getting this error when selecting the subblock and I'm guessing it's because this block only has an _L and not _LR like the other ones. How can I have it only strip off the _L. I don't really even need to select the right side as the root is the same?


Select sub block for name.; error: bad argument type: numberp: nil


Code: [Select]
(defun c:PB (/ bent bname bname2  pos pt ss)
  (setvar "clayer" "V-EXTRACT-NEW")
  (if
    (and
      (setq bent (entsel "\nSelect main block for name."))
      (setq bname (cdr (assoc 2 (entget (car bent))))
            ;; bname (strcase bname)
            bname (vl-string-subst "plangroup_" "plan_" bname)
            bname (vl-string-subst "_" "." bname)
            bname (vl-string-subst "" "_M" bname)
      )
      (setq bent2 (entsel "\nSelect sub block for name."))
      (setq bname2 (cdr (assoc 2 (entget (car bent2))))
            bname2 (strcase bname2)
            pos    (vl-string-position (ascii ".") bname2)
            bname2 (substr bname2 (+ pos 2))
            pos    (vl-string-position (ascii "_") bname2)
            bname2 (substr bname2 1 pos)
            bname  (strcat bname "_" bname2)
      )
      (princ "\nSelect objects to makup the new block.")
      (setq ss (ssget))
      (setq pt (getpoint "\nPick Insert point."))
    )
     (command "-block" bname "non" pt ss ""
              "-insert" bname "non" pt "" "" "")
  )
  (princ)
)code]

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Combining multiple blocks and renaming group block
« Reply #17 on: April 22, 2008, 03:37:20 PM »
Maybe something in the block names.
Upload a sample of these blocks.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

ELOQUINTET

  • Guest
Re: Combining multiple blocks and renaming group block
« Reply #18 on: April 22, 2008, 04:57:20 PM »
Whoops sorry I meant to originally but forgot. You will see that this assembly will consist of 3 sub blocks. If you look you will see that I really only need the core from the center and left like the other so getting the other block info is not neccesary as it's the same except for the end. Anyway take a look and tell me what you think.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Combining multiple blocks and renaming group block
« Reply #19 on: April 22, 2008, 07:39:17 PM »
This should work with both block combinations plan_PK-07 or elev_PK-07.
Is PK-07 a given?

Code: [Select]
;;  CAB 04.22.08
;;  Combine blocks using combined names
;;  Dependant on block name starting with  plan_PK-07 or elev_PK-07
(defun c:PB (/ bent bent2 bname bname2 pt ss LibPrefix *error*)
  (defun *error* (msg)
    (if (not
          (member msg  '("console break" "Function cancelled" "quit / exit abort" "")))
       (princ (strcat "\nError: " msg))
    )
    (and bent (redraw (car bent) 4))
    (and bent2 (redraw (car bent2) 4))
    (princ)
  ) ; end error function

  (setq LibPrefix "PK-07")

 
  (if
    (and
      (setq bent (entsel "\nSelect main block for name."))
      (null (redraw (car bent) 3))
      (setq bname (cdr (assoc 2 (entget (car bent)))))
      (cond
        ((wcmatch bname "plan_*")
          (setq bname (vl-string-subst "plangroup_" "plan_" bname))
         (setvar "clayer" "V-EXTRACT-NEW")
         )
        ((wcmatch bname "elev_*")
          (setq bname (vl-string-subst "elevgroup_" "elev_" bname))
         (setvar "clayer" "0")
         )
      )
      (setq bname (vl-string-subst "_" "." bname) ; change . to _
            bname (vl-string-right-trim "_M" bname) ; remove M & _
      )
      (setq bent2 (entsel "\nSelect sub block for name."))
      (null (redraw (car bent2) 3))
      (setq bname2 (cdr (assoc 2 (entget (car bent2)))))
      (cond
        ((wcmatch bname2 "plan_*")
          (setq bname2 (vl-string-subst "" (strcat "plan_" LibPrefix) bname2)) ; remove the prefix
         )
        ((wcmatch bname2 "elev_*")
          (setq bname2 (vl-string-subst "" (strcat "elev_" LibPrefix) bname2)) ; remove the prefix
         )
      )
      (setq bname2 (vl-string-right-trim "_LR" bname2) ; remove suffix _, L, R
            bname2 (vl-string-left-trim "_." bname2) ; remove prefix _ or .
            bname  (strcat bname "_" bname2)
      )
      (princ "\nNew Block Name ")
      (princ bname)
      (princ "\nSelect objects to makup the new block.")
      (setq ss (ssget))
      (setq pt (getpoint "\nPick Insert point."))
    )
     (command "-block" bname "non" pt ss ""
              "-insert" bname "non" pt "" "" ""
             )
  )
  (*error* "")
  (princ)
)
« Last Edit: April 23, 2008, 03:55:07 PM by CAB »
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

ELOQUINTET

  • Guest
Re: Combining multiple blocks and renaming group block
« Reply #20 on: April 23, 2008, 09:40:58 AM »
Actually now that you mention it CAB PK-07 is the library prefix (Polo Kids 2007) which will change on the next one I do. I thought about it but there is a design period between each usually so I thought it could be incorporated during that lag time. If you have any thoughts about how to do that then by all means go for it. To be honest, I don't really know all of the coding variables as I have not been here long enough to know all of the libraries and options but I do understand the core structure of it so that's a start. I know that almost all libraries have wall cases and this is the standard we are trying to establish so that's why I started with these. Anyway thanks for your help I'll give this a try this morning.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Combining multiple blocks and renaming group block
« Reply #21 on: April 23, 2008, 09:58:00 AM »
I updated the code with the library prefix as a variable.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

ELOQUINTET

  • Guest
Re: Combining multiple blocks and renaming group block
« Reply #22 on: April 23, 2008, 03:14:57 PM »
Hey CAB how would I make it so that if it found a prefix of elev_ it would set the layer to "0" whereas if it found a prefix of plan_ it would set the current layer to "V-EXTRACT-NEW" ?

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Combining multiple blocks and renaming group block
« Reply #23 on: April 23, 2008, 03:55:31 PM »
I changed the code again.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

ELOQUINTET

  • Guest
Re: Combining multiple blocks and renaming group block
« Reply #24 on: April 24, 2008, 03:56:16 PM »
CAB I learned last night that my hunch was not correct as far as the plan blocks are concerned. I assumed that the block names would be the same as the elevations but this is not the case. Basically for the plans instead of having plan_ for the nested blocks and plangroup_ for the assembly block all of the plan blocks only have an _ as the prefix. I tried to modify the code but screwed up somewhere along the way. I'm getting a too few arguments error when selecting the sub block? I changed the syntax in the layer trigger section and removed the prefix removal part for the plans. I'm not sure if it would be easier to edit mine or your but just posted it to show that I am trying to figure this out on my own  :|

Code: [Select]
;;  Dependant on block name starting with  plan_PK-07 or elev_PK-07
(defun c:CBLOCK (/ bent bent2 bname bname2 pt ss LibPrefix *error*)
  (defun *error* (msg)
    (if (not
          (member msg  '("console break" "Function cancelled" "quit / exit abort" "")))
       (princ (strcat "\nError: " msg))
    )
    (and bent (redraw (car bent) 4))
    (and bent2 (redraw (car bent2) 4))
    (princ)
  ) ; end error function

  (setq LibPrefix "PK-07")

 
  (if
    (and
      (setq bent (entsel "\nSelect main block for name."))
      (null (redraw (car bent) 3))
      (setq bname (cdr (assoc 2 (entget (car bent)))))
      (cond
        ((wcmatch bname "_*")
          (setq bname (vl-string-subst "_" bname))
         (setvar "clayer" "V-EXTRACT-NEW")
         )
        ((wcmatch bname "elev_*")
          (setq bname (vl-string-subst "elevgroup_" "elev_" bname))
         (setvar "clayer" "0")
         )
      )
      (setq bname (vl-string-subst "_" "." bname) ; change . to _
            bname (vl-string-right-trim "_M" bname) ; remove M & _
      )
      (setq bent2 (entsel "\nSelect sub block for name."))
      (null (redraw (car bent2) 3))
      (setq bname2 (cdr (assoc 2 (entget (car bent2)))))
      (cond
        ((wcmatch bname2 "elev_*")
          (setq bname2 (vl-string-subst "" (strcat "elev_" LibPrefix) bname2)) ; remove the prefix
         )
      )
      (setq bname2 (vl-string-right-trim "_LR" bname2) ; remove suffix _, L, R
            bname2 (vl-string-left-trim "_." bname2) ; remove prefix _ or .
            bname  (strcat bname "_" bname2)
      )
      (princ "\nNew Block Name ")
      (princ bname)
      (princ "\nSelect objects to makup the new block.")
      (setq ss (ssget))
      (setq pt (getpoint "\nPick Insert point."))
    )
     (command "-block" bname "non" pt ss ""
              "-insert" bname "non" pt "" "" ""
             )
  )
  (*error* "")
  (princ)
)

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Combining multiple blocks and renaming group block
« Reply #25 on: April 24, 2008, 04:33:28 PM »
Dan, I do better with a DWG example. Can you post one?
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

ELOQUINTET

  • Guest
Re: Combining multiple blocks and renaming group block
« Reply #26 on: April 25, 2008, 02:50:56 PM »
Ah OK actually I had a meeting with my boss and learned a few things that are different

If you look at the ungrouped blocks at the bottom you will see that their is no underscore before the M now for the middle case case

If you look at the The ungrouped plan blocks now only have and underscore prefix not plan_
Also the grouped block name now has a prefix of group" instead of plangroup_

On a side note, I discovered through testing that the routine acts a little crazy if the block has already been defined in the drawing. This is not a big deal as I just purge it out then all is well, just wanted to let you know.

ELOQUINTET

  • Guest
Re: Combining multiple blocks and renaming group block
« Reply #27 on: April 25, 2008, 04:11:28 PM »
O my I just realized after all that I forgot to attach the drawing, Genius. TGIF  :ugly:

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Combining multiple blocks and renaming group block
« Reply #28 on: April 25, 2008, 05:24:17 PM »
So this is your final?
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Combining multiple blocks and renaming group block
« Reply #29 on: April 25, 2008, 06:23:16 PM »
Test this:
Code: [Select]
;;  CAB 04.25.08
;;  Combine blocks using combined names
;;  Dependant on block name starting with  plan_PK-07 or elev_PK-07
(defun c:CBlock (/ bent bent2 bname bname2 pt ss LibPrefix *error*)
  (defun *error* (msg)
    (if (not
          (member msg  '("console break" "Function cancelled" "quit / exit abort" "")))
       (princ (strcat "\nError: " msg))
    )
    (and bent (redraw (car bent) 4))
    (and bent2 (redraw (car bent2) 4))
    (princ)
  ) ; end error function

  (setq LibPrefix "PK-07")

 
  (if
    (and
      (setq bent (entsel "\nSelect main block for name."))
      (null (redraw (car bent) 3))
      (setq bname (cdr (assoc 2 (entget (car bent)))))
      (cond
        ((wcmatch bname "_*") ; plan view
          (setq bname (vl-string-subst "group_" "_" bname))
         (setvar "clayer" "V-EXTRACT-NEW")
         )
        ((wcmatch bname "elev_*")
          (setq bname (vl-string-subst "elevgroup_" "elev_" bname))
         (setvar "clayer" "0")
         )
      )
      (setq bname (vl-string-subst "_" "." bname) ; change . to _
            bname (vl-string-right-trim "_M" bname) ; remove M & _
      )
      (setq bent2 (entsel "\nSelect sub block for name."))
      (null (redraw (car bent2) 3))
      (setq bname2 (cdr (assoc 2 (entget (car bent2)))))
      (cond
        ((wcmatch bname2 "_*")
          (setq bname2 (vl-string-subst "" (strcat "_" LibPrefix) bname2)) ; remove the prefix
         )
        ((wcmatch bname2 "elev_*")
          (setq bname2 (vl-string-subst "" (strcat "elev_" LibPrefix) bname2)) ; remove the prefix
         )
      )
      (setq bname2 (vl-string-right-trim "_LRM" bname2) ; remove suffix _, L, R, M
            bname2 (vl-string-left-trim "_." bname2) ; remove prefix _ or .
            bname  (strcat bname "_" bname2)
      )
      (princ (strcat "\nNew Block Name \"" bname "\""))
      (princ "\nSelect objects to makup the new block.")
      (setq ss (ssget))
      (setq pt (getpoint "\nPick Insert point."))
    )
    (if (and ss pt (listp pt))
      (if (tblsearch "BLOCK" bname)
        (alert "Block Combo already exist.")
        (command "-block" bname "non" pt ss ""
                 "-insert" bname "non" pt "" "" "")
      )
    )
  )
  (*error* "")
  (princ)
)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

ELOQUINTET

  • Guest
Re: Combining multiple blocks and renaming group block
« Reply #30 on: April 28, 2008, 10:35:16 AM »
Hey CAB it works fine but there's one thing I'm thinking will cause a problem in the future that I need to explain. For the left and right elevation blocks I am using an _ before the LR to indicate that this is not a true code but I think there will be instances where I won't be able to use a single block for both because they will be graphically different. In other words the elevation may consist of 3 block names like the plan and it would be treated the same. The routine would just strip the L off the end of the left case and ignore the right as it's core code would be the same. Again it works fine for now but I was thinking that to solve this problem it could ask how many blocks the group will consist of with the default being 2 but if 3 was selected then it would only strip L off the left block rather than _LR. Am I making sense or do you want me to post an example?

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Combining multiple blocks and renaming group block
« Reply #31 on: April 28, 2008, 10:51:50 AM »
Update this chart to include the next generation of block names.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

ELOQUINTET

  • Guest
Re: Combining multiple blocks and renaming group block
« Reply #32 on: April 28, 2008, 11:14:45 AM »
OK here ya go. I made the graph true to how many blocks are being used and put some labels and color coding.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Combining multiple blocks and renaming group block
« Reply #33 on: April 28, 2008, 11:21:17 AM »
I don't see a problem with the Alternate Block Naming.
The routine will trim _ and L and R and _L and _R and _LR and _RL

In your Chart I saw no need to select a third block.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

ELOQUINTET

  • Guest
Re: Combining multiple blocks and renaming group block
« Reply #34 on: April 28, 2008, 11:57:41 AM »
Correct there is no need to select a third block but I exploded the group elevation block and renamed the left block somethingL and the right block somethingR and tried to run it and when I selected the left block it still asked me for the sub block? I was thinking that for the elevation it was looking for the _LR while for the plan it was looking for L. What I meant was that if if the group block consists of three nested blocks then all you need to trim off the end is L but if it consists of 2 then you need to trim _LR. Run the routine on the block on the right in the attached drawing and you'll see what I mean.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Combining multiple blocks and renaming group block
« Reply #35 on: April 28, 2008, 12:12:45 PM »
The routine doesn't care what the suffix is as long as it is in this group, _ and L and R and _L and _R and _LR and _RL
 but it is looking for a prefix of _ or elev_, if it doesn't find it the routine quits.
You named the block testL, if you used _testL it would work.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

ELOQUINTET

  • Guest
Re: Combining multiple blocks and renaming group block
« Reply #36 on: April 28, 2008, 02:19:56 PM »
ahhhhhh OK i get it my fault. I didn't realized the exact logic it used to analyze the blocks, cool. You know I've not been wanting to ask you about the creation of the nested blocks because I feel like I'm bugging you too much as is but how hard would it be to have another routine that applies a similar logic for creating the nested blocks names. What I am doing is copying the elevation from the source design drawing using another lisp routine that when I paste it the drawing name it came is placed below as text. This drawing name is the code and will be the core of the block name. The only thing that needs to be added is elev_ for the elevations and _ for the plans. I would like to be able to select the text below and have it add the prefix and create the block. I was just trying to figure out how to deal with the left and right  vs. multiuse blocks. I'm basically trying to avoid typing these codes in as they are very similar and I know I will have many errors that way. Any ideas?

ELOQUINTET

  • Guest
Re: Combining multiple blocks and renaming group block
« Reply #37 on: May 09, 2008, 09:42:27 AM »
hey CAB how hard would it be to have the routine prompt you for the library prefix instead of having to modify the code for each library. If I was to go this route it would have to remember the last prefix enetered so I don't have to enter it everytime. How hard would this be to incorporate. By the way, I'm getting closer to working out the other part I was asking you about creating the inital blocks based on their attribute value. Once I get that I will post it.