Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/25/2023 in all areas

  1. An AcCmColor object is independent of the entity (graphical/non-graphical) to which it applies; hence, you can skip the testing for colour type altogether: (defun c:hn ( / e h n x ) (if (and (setq h (car (entsel "\nSelect hatch: "))) (progn (while (and (setq e (car (entsel "\nSelect text: "))) (not (and (= "TEXT" (cdr (assoc 0 (setq x (entget e))))) (snvalid (setq n (cdr (assoc 1 x)))) ) ) ) (princ "\nText not valid for use as a layer name.") ) e ) ) (vla-put-truecolor (vla-add (vla-get-layers (vla-get-activedocument (vlax-get-acad-object))) n) (vla-get-truecolor (vlax-ename->vla-object h)) ) ) (princ) )
    2 points
  2. Now I am understand this draft! Two different Tubing is connecting with another Tubing! Thank you so much. It was really helpful!
    1 point
  3. You can get the hatch colour something like this (defun c:getcolour ( / MyEnt MyColour) (setq MyEnt (entget (car (entsel "Select Entity")))) (if (= (assoc 420 MyEnt) nil) (setq MyColour (cdr (assoc 62 MyEnt))) (setq MyColour (cdr (assoc 420 MyEnt))) ) ; end if MyColour ) then convert thrue colour to rgb
    1 point
  4. I think I understand, so you want to copy for example YN47G-01 and YN47G_X9Y1 and then paste them Are the new parts an attribute in a block or new text objects. If they are to be new texts, will their relative positions be the same and a fixed size? If it is an attribute to an attribute that should e fairly easy too We might need a sample drawing to work out all the details, but you can select the text and save it in a LISP variable as a list, then highlight the insertion point and paste all the selected texts at one time? Might need a sample drawing showing before and after so we can work out what you are selecting and copying - or just a part of a drawing Last part would be to speed it up so you only need 1 or 2 operations and it will do all 60,000 drawings
    1 point
  5. Bpoly will do something close, to 1st image, note the single line sticking in will be ignored. The only way to make that work maybe is to make it a rectang with a width of 0.000000001
    1 point
  6. You could also use ldata to save the variable to the drawing itself so it can be recalled even after restarting the computer. (or (setq win* (vlax-ldata-get "Window" "Manufacturer")) (setq win* "Brown")) ;if ldata is set will call that fist else defaults to Brown. (initget "Brown Jeldwin Newmar Pollard") (setq win (getkword (strcat "\nSet Window Manufacturer: Brown, JeldWin, Newmar, Pollard <" win* ">: "))) (cond (win (vlax-ldata-put "Window" "Manufacturer" win) ;updates ldata to what was picked. (setq WinOffset (cdr (assoc win winManLst))) ) ((eq win nil) (setq win win*) (vlax-ldata-put "Window" "Manufacturer" win) (setq WinOffset (cadr (assoc win winManLst))) ) )
    1 point
  7. Because ( / esp ) means that esp is a local variable, and the local variable is erased from memory when c:test finishes its function, so it is used to prevent confusion when a variable called esp is used elsewhere. Without this, we would have to come up with new, unique and long variable names every time. You can simply replace ( / esp ) with ( ) to keep one dwg file loaded. but, even if you change that. (setq esp (getreal)) will specify a new one with user input every time. this situation is keep and bring esp just before (getreal) but not open it. and then replace with new value. It's like didn't bring it. so, you can make another variable to store esp as a global variable, and remove 1 from initget to use the previous value with no response (input space bar). like this below (defun c:test ( / esp ) (initget (+ 2 4)) (if (setq esp (getreal (strcat "\nEnter value (or Space Bar < Prev. Value = " (rtos oldesp 2 2) " >)"))) (setq oldesp esp) (setq esp oldesp) ) (setq valor (* 10 esp)) (princ valor) (princ) );fin defun However, if you write it like this, you will get an type error. Because the type of global variable oldesp has never been specified, but rtos has been used. rtos has limitations on the types that can be input. so, you can change like this The first value is set to 10, and when user input is received, it is changed to that value from then on. (setq oldesp 10) (defun c:test ( / esp ) (initget (+ 2 4)) (if (setq esp (getreal (strcat "\nEnter value (or Space Bar < Prev. Value = " (rtos oldesp 2 2) " >)"))) (setq oldesp esp) (setq esp oldesp) ) (setq valor (* 10 esp)) (princ valor) (princ) );fin defun or like this The first value comes out as < Prev. Value = nil >, but since (vl-princ-to-string) is not as picky as rtos, no error occurs and when user input is received, it is changed to that value from then on. (vl-load-com) (defun c:test ( / esp ) (initget (+ 2 4)) (if (setq esp (getreal (strcat "\nEnter value (or Space Bar < Prev. Value = " (vl-princ-to-string oldesp) " >)"))) (setq oldesp esp) (setq esp oldesp) ) (setq valor (* 10 esp)) (princ valor) (princ) );fin defun
    1 point
  8. Would seem to be 2 different tubes you are referring to. Is that the only view you have? Are you knowledgeable in steel shapes and dimensions?
    1 point
  9. Did you try the lisp by CAB that I posted? If that works, it just takes two steps. Is it worth the time?
    1 point
×
×
  • Create New...