Author Topic: Convert string to list?  (Read 17294 times)

0 Members and 1 Guest are viewing this topic.

kruuger

  • Swamp Rat
  • Posts: 625
Re: Convert string to list?
« Reply #60 on: October 09, 2012, 08:58:02 AM »
Unfortunately this makes me realize how little I know about this... there is so much I don't understand in your routine that it hurts.
there are a lot of library function. probably can be squeeze a little without them.

edit - by the way i don't find it necessary to change between versions while the routine is running. Only one optional rebuild per run is enough.
yes, but i have a problem with refresh xref, when detach-attach. anyone have solution how to refresh view when dcl is open? looks like redraw not working

Love the way you create the dcl without a separate file  :o  Is there any problem with that approach?
no. many user do this here. you can very easy create multi-language file.

kruuger


Brick_top

  • Guest
Re: Convert string to list?
« Reply #61 on: October 10, 2012, 06:20:21 AM »
I'm having a hard time accessing objects within a block.

Is this close to what I need?

Code: [Select]
(setq ent (car (entsel "Pick a block: ")))

           (while
             (/= (cdr (assoc 0 (setq elst (entget (setq ent (entnext ent)))))) "SEQEND")
             (setq entlst (append elst entlst))
           );while

edit - I took out "progn" from this code
« Last Edit: October 10, 2012, 06:30:39 AM by Brick_top »

kruuger

  • Swamp Rat
  • Posts: 625
Re: Convert string to list?
« Reply #62 on: October 12, 2012, 03:13:45 AM »
Code: [Select]
; =========================================================================================== ;
; Lista obiektow w definicji bloku / List of objects in block definition                      ;
;  Name   [STR] - nazwa bloku / block name                                                    ;
;  Entity [STR] - nazwa entycji / entity name                                                 ;
; ------------------------------------------------------------------------------------------- ;
; (cd:BLK_GetEntity "*Model_space" nil), (cd:BLK_GetEntity "NAZWA" "*LINE")                   ;
; =========================================================================================== ;
(defun cd:BLK_GetEntity (Name Entity / en dt res)
  (setq en (tblobjname "BLOCK" Name))
  (while
    (and
      en
      (setq en (entnext en))
      (setq dt (entget en))
      (/= "ENDBLK" (cdr (assoc 0 dt)))
    )
    (if
      (if Entity
        (wcmatch (cdr (assoc 0 dt)) (strcase Entity))
        (cdr (assoc 0 dt))
      )
      (setq res
        (cons
          (cdr (assoc -1 dt))
          res
        )
      )
    )
  )
  (reverse res)
)
kruuger

Brick_top

  • Guest
Re: Convert string to list?
« Reply #63 on: October 12, 2012, 03:47:16 AM »
Thank you  for answering again kruuger.

but i'm really sorry to say that I think I might not be using your routine correctly.

what do you mean by this?

Quote
Entity [STR] - nazwa entycji / entity name


edit - now I understand.. and it works! I was thinking it would return every entity in a block and not only one type that I might choose.

I would prefer for it to create a list of every entity in the block, I'll see if I'm able to modify your code.


Many thinks sir!



« Last Edit: October 12, 2012, 04:02:22 AM by Brick_top »

Brick_top

  • Guest
Re: Convert string to list?
« Reply #64 on: October 12, 2012, 03:53:29 AM »
Hi there it seems that my "code" above kind of works by changing "SEQEND" for "ENDBLK", but it only returns 2 entities and my block has 3. I'll keep searching.

kruuger

  • Swamp Rat
  • Posts: 625
Re: Convert string to list?
« Reply #65 on: October 12, 2012, 04:09:13 AM »
Thank you  for answering again kruuger.

but i'm really sorry to say that I think I might not be using your routine correctly.

what do you mean by this?

Quote
Entity [STR] - nazwa entycji / entity name


edit - now I understand.. and it works! I was thinking it would return every entity in a block and not only one type that I might choose.

I would prefer for it to create a list of every entity in the block, I'll see if I'm able to modify your code.


Many thinks sir!
second argument as nil and you got all objects
kruuger

Brick_top

  • Guest
Re: Convert string to list?
« Reply #66 on: October 12, 2012, 05:26:51 AM »
Thanks again  :-)

CADDOG

  • Newt
  • Posts: 82
  • wishbonesr
Re: Convert string to list?
« Reply #67 on: October 16, 2012, 11:57:50 AM »
hi Brick_top

here is very rough sketch of what i describe
1. extract Note folder to drive D:
2. open latest.dwg
3. load lsp
4. type REC
5. select required Note
6. one xref overlay above another. it shouldn't be like that but i have a problem with refreshing screen when dcl is open7. after cancel latest view is restored

kruuger

I know he said he didn't need it (item 6).....
I wanted to just update the code and resubmit, but I don't know which action_tile is commiting the work.
I moved the new_dialog call to the t cond, and added the following usage of preview
Also need a call to restore dialog settings harvested before closing.
Code: [Select]
( T
     (setq preview 2)
     (while (>= preview 2)
       (new_dialog "StdListDialog" dc ""
      (cond
( *cd-TempDlgPosition* )
( (quote (-1 -1)) )
)
      )
       (if settings (restore_dialog_settings_defun))

Leaving the call to start_dialog in it's current location, it would look like this
Code: [Select]
(setq preview (start_dialog))
Which ever action_tile that performed the changes can substitute it's definition with something like
Code: [Select]
"(setq settings (dialog_save_settings_defun))(done_dialog 4)"
Now immediately after start_dialog (mentioned above), perform another cond
Code: [Select]
    (cond
((= 4 preview)
(previewMyChanges_defun)
)
);cond
);while preview >=2 ;cycles back to our dialog

Any other call to done_dialog will generate preview = 1, which will exit the while statement.

kruuger

  • Swamp Rat
  • Posts: 625
Re: Convert string to list?
« Reply #68 on: October 17, 2012, 06:55:11 AM »
thanks CADDOG

it looks like vla-regen do what i want. of course with heavy xrefs will be very slow.
Code: [Select]
...
  (defun _XrefNote (Val / xr)
    (setq xr (kr:BLK_AttachXref "d:\\Note" Val '(0 0 0) 1 1 1 0 nil))
    (vla-regen (vla-get-ActiveDocument (vlax-get-acad-object)) acActiveViewport)
    (if (/= Val fl)
...