Jump to content

All Activity

This stream auto-updates

  1. Today
  2. NirantarVidyarthee

    Convention for naming Properties in Solidworks

    Is the procedure for naming Properties in SolidWorks documented anywhere. I have searched help and web but was unable to find any. For example: "SW-Cost-StockType@food_processor.SLDASM" What does the part before and after @ means. Sometimes there are more than 2 strings separated by @ Sometimes there are more than 2 @ symbols together. Its all confusing. Where can I get info about this?
  3. NirantarVidyarthee

    Solidworks API - Is drawing View Empty?

    Using Solidworks API, how can I find a drawing view is empty? Same is the case with Sketch object. I have searched the help file but can't find anything relevant.
  4. Yesterday
  5. Can you provide your CAD file for us to look at, or some screenshots of what you're trying to render? That error message seems to suggest that you don't have any solids or surfaces that can be rendered.
  6. Is it a block or is it an xref? You can select a detail and get the properties. What happens when you try to remove the block? Does it refuse to delete or does it refuse to purge? Welcome to the forum!
  7. This will convert any dim that has text overridden with distof. --edit updated code to store the old override (undo command?) in the suffix also adds text above the dim of the old dimoverride Note this command should be a temp fix (defun C:DIM-Convert (/ ss dim obj old dist off hgt pt) (if (setq ss (ssget "X" (list '(0 . "DIMENSION") (cons 410 (getvar 'ctab))))) (foreach dim (vl-remove-if 'listp (mapcar 'cadr (ssnamex SS))) (setq obj (vlax-ename->vla-object dim)) (if (eq (setq old (vlax-get obj 'TextOverride)) "") (progn) (progn (setq dist (distof old)) (vla-put-textoverride obj dist) (vla-put-textsuffix obj old) ;store old overide (setq off (* (setq hgt (vlax-get obj 'TextHeight)) 1.5)) (setq pt (vlax-get obj 'TextPosition)) (setq pt (list (car pt) (+ (cadr pt) off))) (entmake (list '(0 . "TEXT")(cons 10 pt)(cons 11 pt)(cons 40 hgt)(cons 1 old)'(072 . 4))) ) ) ) ) (princ) )
  8. mhupp

    select duplicate attributes

    Multi select kinda Pick a block It will list all attribute tags in a dcl menu. Pick witch ones you want to search for from the dcl menu. it will then search all blocks that have attributes for same tag name and value. This will only select blocks that match all tag name + values of the first selectrd block. ;;----------------------------------------------------------------------------;; ;; SEARCH BLOCKS FOR MATCHING ATTRIBUTES (defun C:foo (/ ss2 blk x blkname attlst attag att itm ss ent i) (setq ss2 (ssadd)) (while (setq blk (car (entsel "\nSelect Block"))) (if (and (= "INSERT" (cdr (assoc 0 (setq x (entget blk))))) (setq blkname (cdr (assoc 2 x)))) (progn (setq attlst (mapcar '(lambda (at) (list (vla-get-tagstring at) (vla-get-textstring at))) (vlax-invoke (vlax-ename->vla-object blk) 'getattributes) ) ) (setq attag (mapcar '(lambda (at) (car at)) attlst)) (setq att (AT:ListSelect (strcat "Attribues in " blkname) "Pick A Attribue to search for" 20 20 "true" attag)) (foreach itm attlst ;mapcar mabye? (if (member (car itm) att) (progn) (setq attlst (vl-remove itm attlst)) ) ) (if (setq ss (ssget "X" (list '(0 . "INSERT") '(66 . 1) (cons 410 (getvar 'ctab))))) (foreach ent (vl-remove-if 'listp (mapcar 'cadr (ssnamex SS))) (setq att (entnext ent) i 0 ) (while (eq (cdr (assoc 0 (setq elst (entget att)))) "ATTRIB") (foreach itm attlst (if (and (eq (cdr (assoc 2 elst)) (car itm)) (eq (cdr (assoc 1 elst)) (cadr itm)) ) (setq i (1+ i)) ) ) (if (eq i (length attlst)) (ssadd ent ss2)) (setq att (entnext att)) ) ) ) ) (prompt "\nNot a Block") ) ) (sssetfirst nil ss2) (princ) ) ;; List Select Dialog (Temp DCL list box selection, based on provided list) ;; title - list box title ;; label - label for list box ;; height - height of box ;; width - width of box ;; multi - selection method ["true": multiple, "false": single] ;; lst - list of strings to place in list box ;; Alan J. Thompson, 09.23.08 / 05.17.10 (rewrite) (defun AT:ListSelect (title label height width multi lst / fn fo d f) (setq fo (open (setq fn (vl-filename-mktemp "" "" ".dcl")) "w")) (foreach x (list (strcat "list_select : dialog { label = \"" title "\"; spacer;") (strcat ": list_box { label = \"" label "\";" "key = \"lst\";") (strcat "allow_accept = true; height = " (vl-princ-to-string height) ";") (strcat "width = " (vl-princ-to-string width) ";") (strcat "multiple_select = " multi "; } spacer; ok_cancel; }") ) (write-line x fo) ) (close fo) (new_dialog "list_select" (setq d (load_dialog fn))) (start_list "lst") (mapcar (function add_list) lst) (end_list) (setq item (set_tile "lst" "0")) (action_tile "lst" "(setq item $value)") (setq f (start_dialog)) (unload_dialog d) (vl-file-delete fn) (if (= f 1) ((lambda (s / i s l) (while (setq i (vl-string-search " " s)) (setq l (cons (nth (atoi (substr s 1 i)) lst) l)) (setq s (substr s (+ 2 i))) ) (reverse (cons (nth (atoi s) lst) l)) ) item ) ) )
  9. I had to send my drawing to a consultant and didn't save as - rookie mistake! I used bind xref to make sure he could see the original drawing with my details on it. The problem is now that xref is not updating as changes are being made on the original dwg - I believe it is now a block in my dwg. How can I get rid of it? I have tried deleting it and purge? When I try reattach the xref I get an error message saying the file is already a standard block in the current drawing. "Invalid"
  10. GD.Ritter

    Select inside polygon

    yes, closed polyline. just like in the example i shared before.
  11. Boom. you nailed it. Thanks for the update. it works great!
  12. Distof will take a string, typically assumed to be a length, and convert it to a decimal number (you can set it to do decimals, fractions, etc). So you can have some code that goes through each mtext object, rip the number from it (which will be in the form of a string) and apply distof to it. Then if you want to convert it back to a string rtos should be of use.
  13. grantm

    Demo Lisp

    Hello, Great code. Can this code be updated to include adopting the source line type and line weight of the layer picked? Thanks
  14. PoetEngineer

    Automatic number dimension

    @Steven P THANK YOU MR. STEVEN
  15. Automation/Control of water treatment/pumping plants. We focus on provided hardware and software to manage pumps/chemicals. Most of the CAD stuff is electrical layouts, but every project needs the physical hardware layouts drafted out too, which is where we struggle, lol. We burn plenty of time with our drawings ALWAYS being out of whack. Been a couple times (just in the short 3 months I've been here!) Where they've ran out of space on a panel to house connections... Like jeez
  16. jr.roberto.santos

    select duplicate attributes

    @BIGAL@mhupp Thank you so much for your support. In this example I include the match attribute manually. This would be perfect if it were possible to take the list of previously selected attributes and include them a variable tag1. ;;;;; (defun c:test_WILDCARD (/ ss2 ss tag val n na) (setq tag1 "TAG1,TAG2,TAG3,TAG4") ;;<< trying to include the values of the selected attributes. (setq ss2 (ssadd)) (sssetfirst nil nil) (princ "\nSelect blocks containing attributes.") (if (setq ss (ssget "_:L" '((0 . "INSERT") (66 . 1)))) (progn (setq tag "TAG1F") (setq val tag1) (setq n 0) (repeat (sslength ss) (setq na (ssname ss n)) (if (func_att_match na tag val) (setq ss2 (ssadd na ss2)) );if (setq n (+ n 1));setq );repeat (if (equal (getvar "cmdnames") "") (sssetfirst ss2 ss2) (command ss2) );if );progn then );if (princ) );defun c:test_WILDCARD ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun func_att_match ( na tag val / e1 a b flag) (while (and (setq na (entnext na)) (setq e1 (entget na)) (not (equal (cdr (assoc 0 e1)) "SEQEND")) (not flag) );and (if (equal (cdr (assoc 0 e1)) "ATTRIB") (progn (setq a (cdr (assoc 2 e1)) ;2 is tag b (cdr (assoc 1 e1)) ;1 is value );setq (if (and a (wcmatch a tag) b (wcmatch b val) );and (setq flag T);then jump out of the loop );if );progn then attrib );if );while flag );defun func_att_match ;;(princ "\nType ATTSELECT to run") (princ) ;;;;;;
  17. jr.roberto.santos

    Wildcard text search

    @mhupp Perfect, I just changed the variable ss to ss1 (sssetfirst nil ss1) Best regards
  18. Using the EXTRIM (Express Tool) command you could select a rectangle and pick inside to trim inside.
  19. mhupp

    Wildcard text search

    Looks like BricsCAD searches text without case sensitivity or it might be a variable BIGAL and myself have turned on IDK. This will convert everything to uppercase with strcase (for matching with wcmatch) so case sensitivity doesn't matter. ;;----------------------------------------------------------------------------;; ;; Find and Select Text (defun C:FTXT (/ ss ss1 str) (setq ss1 (ssadd)) (setq str (strcat "*" (strcase (getstring "\nPattern to find: ")) "*")) (if (setq ss (ssget "_X" (list '(0 . "*TEXT") (cons 410 (getvar 'ctab))))) (foreach ent (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))) (setq obj (vlax-ename->vla-object ent)) (if (wcmatch (strcase (vla-get-TextString obj)) str) (setq ss1 (ssadd ent ss1)) ) ) ) (prompt (strcat (itoa (sslength ss1)) " items found")) (sssetfirst nil ss1) (princ) )
  20. Steven P

    Automatic number dimension

    Lets see, copy the LISP to notepad, and find "A-ANNO-DIMS", to see where that appears, see what it says, edit the LISP file and see if that is any help. Think I have it, lets try this, if it works. comment about line 26 "_.layer" "_make" "A-ANNO-DIMS" "_color" 2 "" "" ;; <---EDIT if desired to ;; "_.layer" "_make" "A-ANNO-DIMS" "_color" 2 "" "" ;; <---EDIT if desired where ' ; ' tells CAD to ignore what comes after that in the line, should do it
  21. The 574 dimension has scale overrides. Pick the 574 dimension and right-click then pick "Dim Style" then pick "Save as new style…" and give it a name. Now that it's a dimension style you can use it to draw other dimensions in the same style. Like eldon I prefer everything drawn true size but there are some exceptions to every rule. I've created a lot of typicals and details in Paper Space which required me to use dimensions with scale values. Once they're complete I use Lee Mac's to fix the values so they'll display correct values even if they were scaled to plot at a different size.
  22. Tom Matson

    Looking for 2 click centerline rectangle

    ;; degrees to rad (defun deg2rad (deg / ) (/ (* deg pi ) 180) ) ;; draws a polyline (defun drawLWPoly (lst cls) (entmakex (append (list (cons 0 "LWPOLYLINE") (cons 100 "AcDbEntity") (cons 100 "AcDbPolyline") (cons 90 (length lst)) (cons 70 cls)) (mapcar (function (lambda (p) (cons 10 p))) lst)))) ;; TCCR for: Two Click Centerline Rectangle (defun c:TCCR2 ( / w ang p1 p2 bl br tl tr) (setq w (getreal "\nWidth: ")) (while (setq p1 (getpoint "\nPoint 1:")) (setq p2 (getpoint "\nPoint 2:" p1)) ;; calculate bottom/left, bottom/right,... (setq ang (angle p1 p2)) (setq bl p1) (setq tl (polar p1 (+ ang (deg2rad 90.0)) w)) (setq br p2) (setq tr (polar p2 (+ ang (deg2rad 90.0)) w)) (drawLWPoly (list bl br tr tl) 1) ) ) @Emmanuel Delay I figured it out!! Having your code helped quite a bit. thanks again.
  23. PoetEngineer

    Automatic number dimension

    Hi, thanks for this lisp. But I've a spesific question about that. How can set this lisp to use 'ByLayer' when I using it? is it possible? I don't want to create a new layer "A-ANNO-DIMS". I want this lisp use current layer. thanks a lot again.
  24. Steven P

    Wildcard text search

    Just had a quick check, didn't work here either, and was case sensitive
  25. Tom Matson

    Looking for 2 click centerline rectangle

    Right now I'm not on the computer, but basically if I have a line or Xline I would like to click 2 points just like your other routine but instead of being centered it would be drawn to one side or the other. It would still ask me the width of the rectangle just like it does now....
  26. Emmanuel Delay

    Looking for 2 click centerline rectangle

    I'm not sure what exactly you mean. Could you explain it a bit further (maybe draw a sketch or so)?
  1. Load more activity
×
×
  • Create New...