All Activity
- Today
-
Basith joined the community
-
Hi all, actually some time i forgot to change Defpoints layer to it's desire layer, result is that object are not print as the object is in Defpoints layers, is this possible whenever i open my autocad Defpoints layer color will be in different color instead of white
-
mhupp started following Understanding Variables with a simple routine
-
Understanding Variables with a simple routine
mhupp replied to rcb007's topic in AutoLISP, Visual LISP & DCL
Have to multiply val by 12 to get the correct scale factor of 1/600xp = 1:50' (command "_.zoom" "scale" (strcat "1/" (rtos (* val 12) 2 0) "xp")) - Yesterday
-
mhupp started following Combining text second below first and place in desired location.
-
CAD5642 joined the community
-
Understanding Variables with a simple routine
BIGAL replied to rcb007's topic in AutoLISP, Visual LISP & DCL
A couple of simple changes. (setq val (getint "\nNew scale - Enter = 50 ")) (if (= val nil) (setq val 50)) (command "_.cannoscale" (strcat "1\" =" (rtos val 2 0) "'")) (command "_.zoom" "scale" (strcat "1/" (rtos val 2 0) "xp")) version 2 this will pop a dcl without you doing any code. (if (not AH:Butts)(load "Multi Radio buttons.lsp")) (setq ans (atoi (ah:butts 3 "V" '("Choose a scale" "10" "20" "50" "100" "200" "250" "500" )))) ; ans holds the button picked as an integer value Multi radio buttons.lsp -
How should I proceed to have more hatches? Where do I load them from? Thank you
BIGAL replied to Giovannino60's topic in The CUI, Hatches, Linetypes, Scripts & Macros
A,40,-4,["E",STANDARD,S=2.5,R=0.0,X=-1.8,Y=-2.0],-4 so change the 2.5 or as I suggested make a copy with a new name, if you make it big you may need to change say the -4 this is gap distance. For more E's change the 40, make it less, or less make it bigger, we work in metric. -
Connecting starting and ending vertexes of 3dpolylines in the same vertical plane
BIGAL replied to drdownload18's topic in AutoLISP, Visual LISP & DCL
A simple way is rather than pick two plines drag a line over and like marko_ribar use intersectwith and compare start and end points to intersect point so if not near say start point swap start and end points. You imply which is start end of the two lines. An example using pick point. (setq tp1 (entsel "\nSelect left side inner wall near end : ")) (setq tpp1 (entget (car tp1))) (setq pt1 (cdr (assoc 10 tpp1))) (setq pt2 (cdr (assoc 11 tpp1))) (setq pt3 (cadr tp1)) (setq d1 (distance pt1 pt3)) (setq d2 (distance pt2 pt3)) (if (> d1 d2) (progn (setq temp pt1) (setq pt1 pt2) (setq pt2 temp) ) ) -
Like Steven P look for certain blocks, get their scale so you can set a window of length and height. You can get insertion point and for title blocks was lower left. Then use a plot window with correct scale. something like this designed for layout use. (cond ((= blkname "TITLE_BLOCK_A0_V4" )(setq sc "1=1" psize "ISO full bleed A1 (841.00 x 1189.00 MM)" ll "-6,-6" ur "1175,837" orien "Landscape")) ((= blkname "TITLE_BLOCK_A1_V4" )(setq sc "1=1" psize "ISO full bleed A1 (594.00 x 841.00 MM)" ll "-6,-6" ur "837,590" orien "Landscape")) ((= blkname "TITLE_BLOCK_A1PORT_V4" )(setq sc "1=1" psize "ISO full bleed A1 (594.00 x 841.00 MM)" ll "-6,-6" ur "577,823" orien "Portrait")) ((= blkname "TITLE_BLOCK_A2PORT_V4")(setq sc "1=1" psize "ISO full bleed A2 (420.00 x 594.00 MM)" ll "-6,-6" ur "416,591" orien "Portrait")) ((= blkname "TITLE_BLOCK_A3PORT_V4")(setq sc "1=1" psize "ISO expand A3 (297.00 x 420.00 MM)" ll "-3,-3" ur "280.4,403.5" orien "Portrait")) ((= blkname "TITLE_BLOCK_A4PORT_V4")(setq sc "1=1" psize "ISO full bleed A4 (210.00 x 297.00 MM)" ll "-6,-6" ur "206,293" orien "Portrait")) ((= blkname "TITLE_BLOCK_A1_V4")(setq sc "1=1" psize "ISO full bleed A1 (841.00 x 594.00 MM)" ll "-6,-6" ur "837,590" orien "Landscape")) ((= blkname "TITLE_BLOCK_A2_V3")(setq sc "1=1" psize "ISO full bleed A2 (594.00 x 420.00 MM)" ll "-6,-6" ur "590,416" orien "Landscape")) ((= blkname "TITLE_BLOCK_A3_V4")(setq sc "1=1" psize "ISO full bleed A3 (420.00 x 297.00 MM)" ll "-6,-6" ur "406.5,283.4" orien "Landscape")) ((= blkname "TITLE_BLOCK_A4_V4")(setq sc "1=1" psize "ISO full bleed A4 (297.00 x 210.00 MM)" ll "-6,-6" ur "293,206" orien "Landscape")) ) Again I would reccomend use layouts so much easier for this problem, I had 88 layouts one dwg. There is other code about making layouts like pick a point in model space and enter a scale and layout is made.
-
Combining text second below first and place in desired location.
mhupp replied to lucky9's topic in AutoLISP, Visual LISP & DCL
if they are just text they don't have any formatting. you would have to pull other info like stevenp says. Tricky part is when calculating the text height. You have to look at all text first to see their sizes. if they are different in anyway you then have to inject some math into the mtext string. Using the smallest textsize as the "Base" (cons 40 h) TextString = "\\C5;\\fConsola.ttf|b1|i0|c0|p0;test\\P\\H2x;\\C1;bigtest" bigtest is 2x time bigger the orginal test text layer multiple witch one to choose? same with style if multiple. -
Combining text second below first and place in desired location.
mhupp replied to lucky9's topic in AutoLISP, Visual LISP & DCL
This what i came up with a few weeks back. will work on multiple lines of text or mtext. will create mtext at the current 'textsize variable & keep the formatting. if you don't pick a point it will copy text to the clipboard. ;;----------------------------------------------------------------------------;; ;; COMBINE MULTIPLE TEXT INTO ONE MTEXT (defun c:CMT (/ done lst str) (while (not done) (setvar 'errno 0) (setq e (car (nentsel "\nSelect Text to join: "))) (if (and (= (getvar 'errno) 0) (wcmatch (cdr (assoc 0 (entget e))) "*TEXT") ) (progn (if (not (member (vlax-ename->vla-object e) lst)) (setq lst (cons (vlax-ename->vla-object e) lst)) ) ; end if (redraw e 3) ) (if (= (getvar 'errno) 52) (setq done T) (prompt "\nNothing selected --") ) ) ) (setq lst (reverse lst)) (setq str (vlax-get (car lst) 'TextString)) (setq lst (cdr lst)) (foreach x lst (setq str (strcat str "\\P" (vlax-get x 'TextString))) ) (if (setq pt (getpoint "\nLocation: ")) ;if you pick a point will create mtext if not will copy to clipboard (entmake (list '(0 . "MTEXT") '(100 . "AcDbEntity") '(100 . "AcDbMText") (cons 10 pt) (cons 1 str) '(71 . 5) ;mid center justify ) ) (progn (setq str (vl-string-subst " " "\\P" str)) (vlax-invoke (vlax-get (vlax-get (setq html (vlax-create-object "htmlfile")) 'ParentWindow) 'ClipBoardData) 'setData "Text" str) (vlax-release-object html) ) ) (vla-Regen Drawing acactiveviewport) (princ) ) -
Combining text second below first and place in desired location.
Steven P replied to lucky9's topic in AutoLISP, Visual LISP & DCL
Building on what you have done., (setq text1 (cdr (assoc 1 (entget (car ent1))))) Will give you the text string (text 1 here), if you use other assoc numbers you can get the rest, then add them into the entmake mtext. For example: 8 for layer 62 for colour 40 for height 7 for style EDIT: Try this which will take the values from the text1 - see below from MHUPP, if they are different you might want to do some rule to work out what to use. Noting that the order you create an entity with can be important, you can view the entity description with (entget(car(entsel))) and select something - the command line will tell you what it all is and in the order that CAD likes (it isn't numerical order) (defun M-Text ( layer colour pt height str font / ) (entmakex (list (cons 0 "MTEXT") (cons 100 "AcDbEntity") (cons 8 layer) (cons 62 colour) (cons 100 "AcDbMText") (cons 10 pt) (cons 40 height) (cons 1 str))) (cons 7 font) ) (defun c:comtext ( / ent1 MyEnt1 text1 layer colour height font ent2 text2 CombinedText point) (setq ent1 (entsel "\nSelect first text entity: ")) (setq MyEnt1 (entget (car ent1))) ;; (princ (setq text1 (cdr (assoc 1 (entget (car ent1))))) ) (princ (setq text1 (cdr (assoc 1 MyEnt1))) ) (setq layer (cdr (assoc 8 MyEnt1))) (setq colour (cdr (assoc 62 MyEnt1))) (setq height (cdr (assoc 40 MyEnt1))) (setq font (cdr (assoc 7 MyEnt1))) (setq ent2 (entsel "\nSelect second text entity: ")) (princ (setq text2 (cdr (assoc 1 (entget (car ent2))))) ) (princ (setq CombinedText (strcat text1 "\P" text2))) (princ (setq point (getpoint "\nSelect location for combined text: "))) (M-Text layer colour point height (strcat text1 "\P" text2) font) (princ) ) -
Combining text second below first and place in desired location.
lucky9 replied to lucky9's topic in AutoLISP, Visual LISP & DCL
Thank you for the code, How do I retain the original text formatting for example color, height, font etc. of selected text. -
Steven P started following Combining text second below first and place in desired location.
-
Combining text second below first and place in desired location.
Steven P replied to lucky9's topic in AutoLISP, Visual LISP & DCL
I have a library of entmake routines, so I don't need to copy and paste them every time I want one. get it working once and it will work every time after. Using that instead of your code gives me the below: Try that. Also added a couple of princ to report what the user clicks Problem with your code I think you need the cons 100s: (cons 100 "AcDbEntity")(cons 100 "AcDbMText") (defun M-Text (pt str) (entmakex (list (cons 0 "MTEXT") (cons 100 "AcDbEntity") (cons 100 "AcDbMText") (cons 10 pt) (cons 1 str))) ) (defun c:comtext () (setq ent1 (entsel "\nSelect first text entity: ")) (princ (setq text1 (cdr (assoc 1 (entget (car ent1)))))) (setq ent2 (entsel "\nSelect second text entity: ")) (princ (setq text2 (cdr (assoc 1 (entget (car ent2)))))) (setq point (getpoint "\nSelect location for combined text: ")) (M-Text point (strcat text1 "\P" text2)) (princ) ) -
setvar question - which one controls the display of the multileader pull down
rkent replied to rkent's topic in AutoCAD 2D Drafting, Object Properties & Interface
answering my own question GALLERYVIEW -
lucky9 started following Combining text second below first and place in desired location.
-
Combining text second below first and place in desired location.
lucky9 posted a topic in AutoLISP, Visual LISP & DCL
(defun c:comtext () (setq ent1 (entsel "Select first text entity: ")) (setq ent2 (entsel "Select second text entity: ")) (setq text1 (cdr (assoc 1 (entget (car ent1))))) (setq text2 (cdr (assoc 1 (entget (car ent2))))) (setq point (getpoint "Select location for combined text: ")) (entmake (list (cons 0 "MTEXT") (cons 10 point) (cons 1 (strcat text1 "\P" text2))))) (princ) ) Can anyone help me on this code I wrote. The purpose of the code is to combine two text entities combining as a MText deleting the selected and placing in desired location. When I run the above code it does not work The code runs with the following Error: Select first text entity: Select second text entity: Select location for combined text: nil Please help, thank you -
rkent started following setvar question - which one controls the display of the multileader pull down
-
Hey, I am working and using AutoCAD 2023 after a 2.5 year hiatus. I don't like the way the pull down menus in the ribbon are displayed, this is for text, dims, and mleaders. I knew that 2.5 years ago but I don't remember what the setvar would be. Thanks, Kent
-
Steven P started following PLOT PDF SAVE
-
What I did with my plotting LISPs was to set each option in the plot command line as a variable in the LISP.. Before the LISP gets to the plot command, I ran sub routines to work out what each of these variables should be, some of course are fixed and the routine is a simple "(defun continuewithplot ( / return) (setq return "Yes") return )' type of thing. Others need some working out. That way I can make up the main routine that works and if necessary at a later date adjust these sub routines to suit what I need to do In your case you might for example create a variable MyPageSize and get that worked out earlier in the LISP... and suddenly what you need to do becomes simpler. So you might do a search "how to get CAD pagesize - see if there is something out there that will give you say "A4" or the page coordinates. After that you can make a lookup table for your pages, if the paper size is A4 set MyPageSize "ISO full bleed A4 (297.00 x 210.00 MM)" - if that makes sense,. (command "-plot" "yes" (car x) "DWG TO PDF.PC3" MyPageSize "Millimeters" "Portrait" "No" "Window" llpt urpt MyScale "Center" "yes" MyCtb "yes" "" ) A lot of this could be on the internet with an easy search. Hope this makes sense - ask if you need more details (my plotting LISP is quite long, lots in there to check all the referenced routines and so on work, but little parts I can copy to here)
-
Connecting starting and ending vertexes of 3dpolylines in the same vertical plane
devitg replied to drdownload18's topic in AutoLISP, Visual LISP & DCL
Ok, I will see it. Thanks. -
Connecting starting and ending vertexes of 3dpolylines in the same vertical plane
marko_ribar replied to drdownload18's topic in AutoLISP, Visual LISP & DCL
You have it all there in my posted code... Look for (inters) function and what follows it... -
Help - Scale about Center by a Specific Value
ronjonp replied to barristann's topic in AutoLISP, Visual LISP & DCL
Glad to help. -
Connecting starting and ending vertexes of 3dpolylines in the same vertical plane
devitg replied to drdownload18's topic in AutoLISP, Visual LISP & DCL
Hy marko, would you , please, show the way you solve such situations. For inverted polys?? -
How should I proceed to have more hatches? Where do I load them from? Thank you
CyberAngel replied to Giovannino60's topic in The CUI, Hatches, Linetypes, Scripts & Macros
To change the size of the label, change the S (scale) parameter for the text in the linetype file. You will have to reload the linetype in your drawing before you see the change. It's complicated, but this is from a very early version of the software, and they can't change it. -
Connecting starting and ending vertexes of 3dpolylines in the same vertical plane
drdownload18 replied to drdownload18's topic in AutoLISP, Visual LISP & DCL
I have always polylines in same direction, but for code it will be good to avoid this. -
Connecting starting and ending vertexes of 3dpolylines in the same vertical plane
marko_ribar replied to drdownload18's topic in AutoLISP, Visual LISP & DCL
I've accounted for that cases in my version... Thanks for reply, though... -
Connecting starting and ending vertexes of 3dpolylines in the same vertical plane
drdownload18 replied to drdownload18's topic in AutoLISP, Visual LISP & DCL
Thanks! It works for multiple pairs! -
devitg started following Connecting starting and ending vertexes of 3dpolylines in the same vertical plane
-
Connecting starting and ending vertexes of 3dpolylines in the same vertical plane
devitg replied to drdownload18's topic in AutoLISP, Visual LISP & DCL
What about if polylines are "invert" so the end to end and start to star will make a self intersecting 3dpolyline -
Lisp to set all properties inside a block to ByBlock
Thomas Schlüssi replied to Kurpulio's topic in AutoLISP, Visual LISP & DCL
Thank you really much!