Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/13/2019 in all areas

  1. oh dear... hope nothing serious and you'll be soon better & back home!
    1 point
  2. You can't honestly expect someone to do your homework for you??? Show us what you have and when you get stuck you can certainly ask for help, but come on at least make some effort.
    1 point
  3. I have not read this thread closely so excuse me if I'm way off .. that last error I'm assuming that that '(cadr y)' is a point? If so then use: (vlax-3D-Point (cadr y)) Although I'd use entmake as it's generally faster: Have you seen Lee's point manager? You could also use his readcsv function to bring your data in. Simple example: (defun c:foo (/ csv f) (if (and (setq f (getfiled "Select a CSV File" "" "csv" 16)) (setq csv (lm:readcsv f))) (foreach l csv ;; we have at least 4 items in the sublist (if (> (length l) 3) (entmakex (list '(0 . "point") ;; First item is layername ? (cons 8 (car l)) ;; Next 3 are X Y Z ? (cons 10 (list (atof (cadr l)) (atof (caddr l)) (atof (cadddr l)))) ) ) ) ) ) (princ) ) (princ)
    1 point
  4. The second part results in the separated parts of the text between the commas, resulted in between_commas, just that they're in a list, so you can say... the first item in the list is the pointID, the second item in the list is the y_Coordinate,.... Of course, it's always up to you to modify your routines. I'm just offering alternative ways. Thanks, Jonathan Handojo.
    1 point
  5. There's your error. Put (apply 'vlax-3D-Point (cadr y))
    1 point
  6. Well, first of all, try not to use vl-cmdf or command. This will really slow you down for sure. For example, in making new layers, you can create a list of dotted pairs, and then run mapcar to iterate through each one: (setq acadobj (vlax-get-acad-object) adoc (vla-get-ActiveDocument acadobj) msp (vla-get-ModelSpace adoc) layer_color (list '("°Point NUM" . 3) '("°Point H" . 2) '("°Point CODE" . 1) '("°Point NOTE" . 8) '("°Point 2D" . 7) '("°Point 3D" . 5) ) ) (mapcar '(lambda (i) (if (not (tblsearch "Layer" (car i))) (vla-put-Color (vla-Add (vla-get-layers adoc) (car i)) (cdr i))) ) layer_color ) And here is an example that you can iterate through commas to save you coding space and time: (setq text "12,23,34,45,56,67,89," between_commas nil) (while (vl-string-search "," text) (setq between_commas (cons (substr text 1 (vl-string-search "," text)) between_commas) text (substr text (+ 2 (vl-string-search "," text)))) ) (setq between_commas (reverse between_commas)) Result is between_commas each in a list. You can even do the same with the variables. After which, you can do (mapcar 'cons variable text) or other lambda functions other than cons. Last but not least: (setq text_height 10 ; assumed, can change to suit combinations (list (list "°Point H" (list tekst_y height_x 0) coord_z) (list "°Point CODE" (list code_x coord_x 0) code) (list "°Point NOTE" (list note_y height_x 0) note) ) ) (mapcar '(lambda (x) (vla-put-layer (vla-AddText msp (caddr x) (apply 'vlax-3D-Point (cadr x)) text_height) (car x))) combinations ) Hopefully that helps with speeding you up some. Thanks Jonathan Handojo
    1 point
  7. What colour to what colour? Or did you mean all bylayer/byblock?
    1 point
  8. I didn't realise that AutoCAD itself had a command called, 'BSCALE' which i could use to enlarge selected blocks by their insertion point! I believe this could be the answer. Thanks for your help with this.
    1 point
  9. Okay (defun c:blss () (pl:block-color-ssget) (princ)) (defun c:blcc () (pl:block-color) (princ)) (defun c:encc () (pl:block-ent-color) (princ)) ;;;get from Alaspher http://forum.dwg.ru/showthread.php?t=1036 ;;; http://forum.dwg.ru/showpost.php?p=166220&postcount=18 (vl-load-com) (defun pl:block-color-ssget (/ adoc blocks color ins lays ss i blocks_done blockname) (setq adoc (vla-get-activedocument (vlax-get-acad-object)) blocks (vla-get-blocks adoc) lays (vla-get-layers adoc) color (acad_colordlg 256) ) (if color (progn (setvar "errno" 0) (vla-startundomark adoc) (setq blocks_done (list)) (princ "\nSelect block objects, then press Enter: ") (while (setq ss (ssget)) ;; (list (cons 0 "INSERT")) (setq i 0) (while (setq ins (ssname ss i)) (if (= "INSERT" (cdr (assoc 0 (entget ins)))) (progn (setq ins (vlax-ename->vla-object ins)) ;; we don't need the car here, because (car (entsel)) removes the pick point ... (if (= (vla-get-objectname ins) "AcDbBlockReference") (if (vlax-property-available-p ins 'path) (princ "\nThis is external reference! Try pick other.") (progn ;; let's skip duplicates (setq blockname (vla-get-name ins)) (if (member blockname blocks_done) ;; if we already did this block, we skip it (progn (princ "\nSkipping block: ") (princ blockname) ) (progn (princ "\n") (setq blocks_done (append blocks_done (list blockname))) (_pl:block-color blocks ins color lays) (vla-regen adoc acallviewports) ) ) ) ) (princ "\nThis isn't block! Try pick other.") ) ) ;; else, put the color to the entity (progn (vla-put-color (vlax-ename->vla-object ins) color) ) ) (setq i (+ i 1)) ) ) ;; / while (vla-endundomark adoc) ) ) (princ) ) (defun pl:block-ent-color (/ adoc blocks color ent lays) (setq adoc (vla-get-activedocument (vlax-get-acad-object)) lays (vla-get-layers adoc) color (acad_colordlg 256) ) (if color (progn (setvar "errno" 0) (vla-startundomark adoc) (while (and (not (vl-catch-all-error-p (setq ent (vl-catch-all-apply (function nentsel) '("\nSelect entity <Exit>:") ) ) ) ) (/= 52 (getvar "errno")) ) (if ent (progn (setq ent (vlax-ename->vla-object (car ent)) lay (vla-item lays (vla-get-layer ent)) ) (if (= (vla-get-lock lay) :vlax-true) (progn (setq layloc (cons lay layloc)) (vla-put-lock lay :vlax-false) ) ) (vl-catch-all-apply (function vla-put-color) (list ent color)) (vla-regen adoc acallviewports) ) (princ "\nNothing selection! Try again.") ) ) (foreach i layloc (vla-put-lock i :vlax-true)) (vla-endundomark adoc) ) ) (princ) ) (defun pl:block-color (/ adoc blocks color ins lays) (setq adoc (vla-get-activedocument (vlax-get-acad-object)) blocks (vla-get-blocks adoc) lays (vla-get-layers adoc) color (acad_colordlg 256) ) (if color (progn (setvar "errno" 0) (vla-startundomark adoc) (while (and (not (vl-catch-all-error-p (setq ins (vl-catch-all-apply (function entsel) '("\nSelect block <Exit>:") ) ) ) ) (/= 52 (getvar "errno")) ) (if ins (progn (setq ins (vlax-ename->vla-object (car ins))) (if (= (vla-get-objectname ins) "AcDbBlockReference") (if (vlax-property-available-p ins 'path) (princ "\nThis is external reference! Try pick other.") (progn (_pl:block-color blocks ins color lays) (vla-regen adoc acallviewports) ) ) (princ "\nThis isn't block! Try pick other.") ) ) (princ "\nNothing selection! Try again.") ) ) (vla-endundomark adoc) ) ) (princ) ) (defun _pl:block-color (blocks ins color lays / lay layfrz layloc) (vlax-for e (vla-item blocks (vla-get-name ins)) (setq lay (vla-item lays (vla-get-layer e))) (if (= (vla-get-freeze lay) :vlax-true) (progn (setq layfrz (cons lay layfrz)) (vla-put-freeze lay :vlax-false)) ) (if (= (vla-get-lock lay) :vlax-true) (progn (setq layloc (cons lay layloc)) (vla-put-lock lay :vlax-false)) ) (vl-catch-all-apply (function vla-put-color) (list e color)) (if (and (= (vla-get-objectname e) "AcDbBlockReference") (not (vlax-property-available-p e 'path)) ) (_pl:block-color blocks e color lays) ) (foreach i layfrz (vla-put-freeze i :vlax-true)) (foreach i layloc (vla-put-lock i :vlax-true)) ) ) (progn (princ "\nBLSS - Changes color of a window selection of blocks") (princ "\nBLCC - Changes color of the chosen blocks") (princ "\nENCC - Changes color of the chosen objects (may be element of the block)") (princ) )
    1 point
  10. As I remember was the R12 released for DOS, Window and Unix. One of my major customer(a large train manufacture) still works in R12 for Unix to produce electrical diagrams.
    1 point
×
×
  • Create New...