Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/27/2023 in all areas

  1. Just do -wblock and follow the prompts so it then becomes. (command "-wblock" fname "" "0,0" zoek "")
    2 points
  2. 1 point
  3. OK, in this case you should need to use a double '\\' Try it and see perhaps with a test of the plotting routine you are making, at the plot stage type in the string in the LISP "C:\Users\user1\Desktop\PDF\" and see what it does.... If you type in the command line (getvar 'dwgprefix) it will show it with a double \\.... so in this case your code is OK at the moment, double \\s are good here.
    1 point
  4. What are you using the file path for?
    1 point
  5. doesn't look like dxfout isn't supported. use this command instead. https://help.solidworks.com/2021/english/DraftSight/html/hlpid_block_wblock.htm
    1 point
  6. find attached , STIG MADSEN SYSVARS sysvar-2006.rar
    1 point
  7. Please dig at INSUNITS system variable , as you will note , 4 for mm or 5 for meter , and 1 for inch , and 2 for feet , so read by (setq insunits (getvar 'insunits)) And change to (setvar 'insunits 4 ) to mm or (setvar 'insunits 5 ) to meter and before send (setvar 'insunits 2 ) to feet And at last and not least , save dwg with some postfix to denote which insunits the are.
    1 point
  8. And it seem to be , they never will change . And furthermore complex is that at the machining like at lathes and mill the work in imperial fractional , and imperial decimal measures And screw becomes in # , wires in circular mill , all a mess to handle.
    1 point
  9. Hi Bigal , you are true. But despite it , here in Argentina metal sheet plate is sell in 2 formo 1000 x 2000 , and 1220 x 2440 , for a 4 x 8 foot , also vinyl paper becomes in 610 mm for 2 foot . We have also bolts and nuts in mm and inches, but angle , tee, and flats in inches, and structural pipes rectangle in mm in wide and high , but thickness in inches , wood is sell by feet thickness . But conglomerate plywood in mm . I noticed that most student open a new drawing acad dwt , and not in acadiso.dwt, as young people never hear about imperial system .
    1 point
  10. The secret hand shake has been given, and the Crust have spoken...a great Beginners forum post!
    1 point
  11. "bad argument type <<Entity name: 1c423a40>> ; expected VLA-OBJECT at [vlax-invoke]" Tells you everything..... Argument - entity name - but it is expecting a VLA-Object at your line vlax-invoke Or... you are using an entity name (pline) and the line wants a VLA-Object name. (setq pline_Obj (vlax-ename->vla-object pline_Ent)) Should do that for you. I couldn't find 'vertices (I don't do too much with VLA) - was giving me an error at that so got vertices by entget: (defun c:DTOL () (defun mAssoc ( key lst ) (foreach x lst (if (= key (car x)) (setq l (cons (cdr x) l)) ) ) (reverse l) ) (setq pline_Ent (car (entsel "\nSelect a polyline: "))) (setq numtri (getint "\nEnter the number of triangles: ")) (setq pline (vlax-ename->vla-object pline_Ent)) ;;https://www.cadtutor.net/forum/topic/24364-vertices-of-a-polyline/ (setq vertices (mAssoc 10 (entget pline_Ent)) ) ; (setq vertices (vlax-invoke pline 'vertices)) (setq num-vertices (length vertices)) (setq spacing (/ (vlax-curve-getDistAtParam pline (vlax-curve-getEndParam pline)) (+ numtri 1))) (setq startpt (vlax-curve-getStartPoint pline)) (setq endpt (vlax-curve-getEndPoint pline)) (setq midpoint (polar startpt (angle startpt endpt) (/ (distance startpt endpt) 2.0))) (setq vertex1 (polar midpoint (/ pi 2) (/ spacing 4.0))) (setq vertex2 (polar midpoint (/ (* 3 pi) 2) (/ spacing 4.0))) (setq i 0) (while (< i numtri) (setq pt1 (vlax-curve-getPointAtDist pline (+ spacing (* i spacing)))) (setq pt2 (polar pt1 (angle startpt endpt) (/ (distance startpt endpt) 2.0))) (setq pt3 (polar pt2 (/ pi 2) (/ spacing 4.0))) (setq pt4 (polar pt2 (/ (* 3 pi) 2) (/ spacing 4.0))) (command "_.pline" pt3 pt4 pt2 "" pt1 "") (setq i (+ i 1)) ) (princ) ) Though the triangles part wasn't quote working for me - you can adjust that though?
    1 point
  12. Bricscad uses Blade not Vlide but similar approach to debugging code. Not sure about this with no image or dwg to compare. (command "_.pline" pt3 pt4 pt2 "" pt1 "") Always post an image or dwg helps sometimes way shorter and smarter solutions are offered.
    1 point
  13. The first step to becoming a proficient programmer is learning how to debug code. Open up the VLIDE and set break on error. Then load the selection: There are a couple of issues with line 3: (setq vertices (vlax-invoke pline 'vertices)) vlax-invoke requires a VLA-OBJECT (vlax-ename->vla-object pline) and a polyline does not have a vertices property, it's coordinates. Here is a common way to get LWPOLYLINE coordinates (mapcar 'cdr (vl-remove-if '(lambda (x) (/= 10 (car x))) (entget pline))) This returns ((X Y) (X Y) (X Y) (X Y)) Another way is like this which works on "heavy" polylines as well: (vlax-get (vlax-ename->vla-object pline) 'coordinates) This returns (X Y X Y X Y X Y) It does not look like you're using the vertices variable for anything except setting the num-vertices variable ? An easier way to get that number is through the 90 DXF code. (cdr (assoc 90 (entget pline)))
    1 point
  14. If I remember the code I gave had a sub-function, make text, fairly standard stuff and maybe worth copying to be a LISP on its own. You'll need a command to tell the LISP to make text. (defun MakeText ( MyText TextPoint textHeight / ) ; Sub Function (entmake (list '(0 . "TEXT") '(100 . "AcDbEntity") '(8 . "0") '(100 . "AcDbText") (cons 10 TextPoint) (cons 40 textheight) ;; '(46 . 0.0) (cons 1 MyText) '(50 . 0.0) '(41 . 1.0) '(51 . 0.0) ;; (cons 7 font) '(71 . 0) '(72 . 0) '(11 0.0 0.0 0.0) '(210 0.0 0.0 1.0) '(100 . "AcDbText") '(73 . 0) ));end list, entmake ) Then for your last line: (PRINC (STRCAT "\nText = " op " " (RTOS height 2 2) "m")) make this into a variable for example, and use that to make the text as above. Perhaps this. The 2.5 is the text height you can change that to suit you. (SETQ MYTEXT (STRCAT "\nText = " op " " (RTOS height 2 2) "m")) (SETQ MYPT (GETPOINT "SELECT TEXT POSITION")) (MakeText MYTEXT MYPT 2.5) (PRINC MYTEXT) This should let you make text in the drawing You can modify and add that to the last part of Tharwats code to make text in the drawing
    1 point
  15. This. but it doesn't solve the problem just makes one big selection set. (setq SS (ssget '((0 . "*TEXT,DIMENSION") (1 . "*#*,~*@*")))) Need to find the entities that are only in both selection sets. texts that have numbers but don't have any letters. and unless your going to process a lot of text. I think it might be a wash. Since distof weeds out the text you can't use. but you can look at this and pull a few functions so you can process text that have letters and numbers. (if (setq SS (ssget '((0 . "*TEXT,DIMENSION") (1 . "*#*")))) (progn (if (setq SS1 (ssget "_P" '((0 . "*TEXT,DIMENSION") (1 . "~*@*")))) (foreach text (vl-remove-if 'listp (mapcar 'cadr (ssnamex SS1))) (if (ssmemb text ss) (ssadd text ss2) ) ) ) ) )
    1 point
  16. Don't need to limit things not no locked layers since your just reading the values, and (0 . "TEXT,MTEXT") can be shorted to just (0 . "*TEXT") This will allow you to select any text. it will only add up text that is only numbers. since distof will only work if the string is only numbers. ;;----------------------------------------------------------------------------;; ;;Sum of selected text that is only numbers (defun C:foo (/ sum ss) (setq sum 0) (setq SS (ssget '((0 . "*TEXT") (1 . "*#*")))) (foreach text (vl-remove-if 'listp (mapcar 'cadr (ssnamex SS))) (if (setq x (distof (cdr (assoc 1 (entget text)))) (setq sum (+ x sum)) ) ) ) (entmake (list (cons 0 "TEXT") (cons 1 (rtos sum 2 3)) (cons 10 (getpoint)) (cons 40 (getvar "TEXTSIZE")))) (princ) )
    1 point
×
×
  • Create New...