Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/22/2025 in all areas

  1. If you make an insert lisp it would be easiest to change the layer prior to insert or even change it after insert. You could use a dcl list of layers that say match a certain group of layer names. You could have more than one insert lisp so multiple groups of layers. Even select an existing object and set to its layer. Eg Trees group "small tree" "medium tree" "gum tree"
    2 points
  2. Hi I understand that it's sorting based on the first number in each row Maybe this can help you (defun c:draganK (/ nmarch nmarch1 arch arch1 linea separa<->campos lst lstA v) (defun separa<->campos (tx lstCtrs / c p l) (foreach c (vl-string->list tx) (if (member (setq c (chr c)) lstCtrs) (if p (setq l (cons (atof p) l) p nil)) (setq p (if p (strcat p c) c)) ) ) (reverse (if p (cons (atof p) l) l)) ) (setvar "DIMZIN" 0) (if (setq nmarch (getfiled "Select source file" "" "*" 2 ) ) (if (setq arch (open nmarch "r")) (if (setq arch1 (open (setq nmarch1 (strcat (vl-filename-directory nmarch) "\\" (vl-filename-base nmarch) "_sorted" (vl-filename-extension nmarch) ) ) "w" ) ) (progn (while (setq linea (read-line arch)) (setq lst (separa<->campos linea '("," ";" " ")) lstA (cons lst lstA) ) ) (foreach v (vl-sort lstA '(lambda (a b) (< (car a) (car b)))) (write-line (foreach x v (setq s (if s (strcat s "\t" (rtos x 2 3)) (rtos x 2 3)))) arch1) (setq s nil) ) ) ) ) ) (if arch (close arch) ) (if arch1 (progn (close arch1) (startapp "notepad" nmarch1) ) ) (princ) )
    1 point
  3. To do what you want ideally might be possible but you are going to have to spend some time to make it so. Perhaps that investment in time will be worth it, perhaps not. You might first off look at Lee Macs 'Steal' routine - allows you to pick a block in another drawing to import (I think), then use something like (entlast) and (entmod.....) to change the imported blocks layer. As Mhupp says make the process a logical order for you - select layer before or after insert. And so onto a whole world of programming... If you look at grread, grdraw and grvecs, help says "Only specialized AutoLISP routines need this function." Grread will return what the user is doing, whether it is a mouse movement, mouse click, keyboard entry. - If keyboard entry you can record this as the layer to insert into, create the layer as you go. - If mouse click you can use this as user wants to place block there and then run the insert command according to the pointer location at the mouse click - and now the fun part, if mouse movement is recorded Look at grdraw and grvecs, Lee Mac has some examples on his website, you can draw temporary lines on the screen, these can be redrawn every time the mouse is moved using the output of grread as the mouse position. You can get the 'bylayer' colour of the blocks destination layer and graw these lines a suitable colour if you want. You are also going to want to create a vector list for an approximation of the new blocks shape (vector list: list of points to draw lines between) - approximation because grvecs only draws lines, not curves or text. You might be happy to represent the block as a rectangle using bounding box method to get the size. Final thing is to find the zoom level of the space you are drawing into (else any lines you draw will always be the same regardless of zoom on or out) So now with a vector list of approximate points for the block, the layer colour, and scale you can draw with grvecs lines on the screen to show the block at the right colour and scaled to the space zoom level. This can follow the mouse pointer. Putting all this together anytime the mouse moves after block selection the block representation will be shown on screen, until mouse click text can be entered to change the layer. And I reckon this would take a while to make it nice - a week or more for me. I'd use steal....
    1 point
  4. lisp isn't multi thread so you either have to store things and call them later in the lisp or do things in a logical order like BIGAL points out. see if this works save current layer (Modified) ListSelect to select what layer you want to insert on change current layer to picked "pauses" insert command for user to select point change back to old layer InsertBlock.lsp
    1 point
×
×
  • Create New...