Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/12/2024 in all areas

  1. I don't do much in 3d but why would you not just draw the correct sizes to start with, by that I mean use a front end. I just tend to do this type of thing from 1st principles, within lisp can do extrude, subtract etc.
    2 points
  2. I have 2 make layouts lisp, working on a 3rd method. You can walk along a p/Line and it makes rectangs at correct scale matching your title block, it rotates the rectangs to following the line work so layouts are displayed horizontally. The second is a more grid style where you just make the 1st rectang at scale again then copy it see movie. The 3rd doing now is for more a parts style solution just pick a point in model, select scale and title block, matching layout is made. Draw rectangs.mp4 Ok a comment , for me you don't scale your mview shape, rather the mview is fixed shape within a title block, the title block exists in a layout at 1:1 scale, true size, the mview has its scale set to desired scale. See image above. Withe the title block fixed and at a known point like 0,0 it makes auto plotting easy. Ok I charge a price like a cup of coffee as the code needs to be set up to suit your title blocks. Yes can be imperial or metric. Also check the word doc.Lisp files Apr 2024.docx
    2 points
  3. I have select a dynamic block you will then be asked to pick say a visibility state or in your case an extrusion shape. Not sure how that works. It is a global routine works for any dynamic block. It will need changing to suit your task. Post a block or send via PM if you have copyright problems. Need one to look at. .Multi radio buttons.lsp Dynamic block get-put-part2.lsp
    1 point
  4. In your radio button action tile you should be able to put the open image function in there so when you change the radio button it will open, same as if it was in 'OK', or call a subroutine to do the processing you want. A lot of respect to the Dragon, and I think his plan might be better that you create a list of images to open, and on 'OK' close the dialogue and open the images at the end. If you open each on a radio button click the opened image will take the focus of your computer and you'll have to keep jumping back to CAD for the next image... it won't be as quick as you might think. Select them first and open them all at the end will be a quicker process.
    1 point
  5. This was bugging me earlier - will look at that also SLW210
    1 point
  6. You're gona need to built a list with the filenames for all the images (with toggles / listbox) and the very last line in your code must be (foreach image image-list (attach / open / insert whatever ...)) some help here : https://help.autodesk.com/view/ACD/2015/ENU/?guid=GUID-10F5B2F6-5D84-4B60-8ED5-D0B3A2644275 (vl-load-com) (defun c:Example_ImageFile() ;; This example inserts a raster image and then finds the ;; ImageFile for the image. (setq acadObj (vlax-get-acad-object)) (setq doc (vla-get-ActiveDocument acadObj)) ;; This example uses the "2d Projected Polylines.jpg" found in the Sample ;; directory. If you do not have the image, or if it is located ;; in a different directory, insert a valid path and name for the ;; imageName variable below. (setq insertionPoint (vlax-3d-point 5 5 0) imageName ".\\Sample\\VBA\\2d Projected Polylines.jpg" scalefactor 1 rotAngle (/ (* 0 3.141592) 180)) ;; Creates a raster image in model space (if (/= (findfile imageName) nil) (progn (setq modelSpace (vla-get-ModelSpace doc)) (setq raster (vla-AddRaster modelSpace (findfile imageName) insertionPoint scalefactor rotAngle)) (vla-ZoomExtents acadObj) ) (alert (strcat imageName " could not be found.")) ) ;; Find the current ImageFile (vla-Regen doc :vlax-true) (alert (strcat "The ImageFile is currently set to: " (vla-get-ImageFile raster))) )
    1 point
  7. It does move very slightly in my AutoCAD if Width is 1 and then only vertically. You might also look into line space style on the MText after Txt2Mtxt I set to exact and it lined up. Not sure about ZWCAD.
    1 point
  8. Had another look at this one, if you entmake the mtext using the text as a basis, it will shift in a similar way to txt2mtxt command. The insert points are still the same as in your example but it is as if there is a border around dtext that isn't there in mtext. Might have to accept that this is still a bit buggy to get them lined up exactly. Test code but noting the new mtext in this retains the width of the text style - would need to add a bit more to adjust that to the original taxt width (defun c:test ( / MyEnt ) ;; Get entity data (setq MyEnt (car (entsel "Select Text"))) ;; Select Entity (setq MyEntHJust (cdr (assoc 72 (entget MyEnt)))) ;; Get H Justification (setq MyEntVJust (cdr (assoc 73 (entget MyEnt)))) ;; Get V Justification ;;Get justification codes (if (= MyEntHJust 0)(setq JU 1)) (if (= MyEntHJust 1)(setq JU 2)) (if (= MyEntHJust 2)(setq JU 3)) (if (= MyEntHJust 3)(setq JU 1)) (if (= MyEntVJust 0)(setq JU (+ JU 6))) (if (= MyEntVJust 1)(setq JU (+ JU 6))) (if (= MyEntVJust 2)(setq JU (+ JU 3))) (if (= MyEntVJust 3)(setq JU (strcat JU 0))) ;; Create mtext (entmake (list '(0 . "MTEXT") '(100 . "AcDbEntity") (assoc 410 (entget MyEnt)) ;; space (assoc 8 (entget MyEnt)) ;; layer (if (= (assoc 62 (entget MyEnt)) nil)(cons 62 256) (assoc 62 (entget MyEnt)) ) '(100 . "AcDbMText") (assoc 10 (entget MyEnt)) ;; insert point (assoc 40 (entget MyEnt)) ;; text height (cons 71 JU) ;; attachment point, 0-9 '(72 . 5) (assoc 1 (entget MyEnt)) ;; text value (assoc 7 (entget MyEnt)) ;; text style (assoc 41 (entget MyEnt)) ;; Width (cons 42 (cdr (assoc 41 (entget MyEnt)))) ;; text width (assoc 50 (entget MyEnt)) ;; rotation '(73 . 1) ;; line spacing '(44 . 1.0) ;; line spacing factor )) (princ) )
    1 point
  9. If you place them on different layers, there can be a huge batch from which to select.
    1 point
  10. You might want, or be able to xref them in? I haven't really worked with Dynamic blocks much, although when they were first introduced, I was keen to delve into them. Using ProSteel add on these days, I don't have nearly as much use for them as back in the day.
    1 point
  11. Why not do it all in one go ? That is what I am suggesting. @Dadgad is hinting can help he can use the front end if useful, was done using this. The profiles could be selected from images rather than just a description. Multi GETVALS.lsp
    1 point
  12. PRESSPULL it is . I haven't used it in years, have a shortcall set as PP. I've done quite a bit of sometimes rather complex 3D modeling. PP is much easier to use than EXTRUDE, because it will work on just about anything. Doesn't require a CLOSED polyline. I am still under the gun, trying to get a new project issued for fabrication. When time permits I'll come back and play with this a bit.
    1 point
  13. Just a ps made a movie of the 3rd method buts its like 38Mb if you want to look at it can send just PM me with an email link, will send via Wetransfer.
    1 point
  14. Talking to Butch via email putting something together. based on this starting point and pick point in model, layout made and mview created at correct scale.
    1 point
  15. If you use VL can use the Textoverride property. (defun c:wow ( / obj str) (setq obj (vlax-ename->vla-object (car (entsel "\nPick text object ")))) (setq str (vlax-get obj 'textstring)) (setq obj (vlax-ename->vla-object (car (entsel "\nPick Dim object ")))) (vlax-put obj 'Textoverride str) (princ) ) ; (vlax-put obj 'Textoverride (strcat "<> " str))
    1 point
  16. From the documentation, the StationOffset method will accept an X & Y coordinate and return two output parameters (station & offset), as such, you'll need to supply the appropriate number of parameters, e.g.: (vlax-invoke-method objAlign 'StationOffset (car point) (cadr point) 'stn 'off) (print stn) (prin1 off)
    1 point
  17. Note, Explode, PurgeAll and plot are all part of the API, accessible through pyautocad or win32com I'll add it
    1 point
  18. Please use Code Tags for your code in the future. (<> in the editor toolbar)
    1 point
  19. “but with the AutoCAD to accepting anything.” then test IAcadState. state : Ax.IAcadState = theApp.GetAcadState() print(state.IsQuiescent) # True: AutoCAD is idle ActiveX is COM automation, this is what pyautocad and win32com use to communicate with AutoCAD. I used win32com’s makepy to generate the interface, then added converters to remove the need for variants. PyRx is in process, the procedure is load in a python script with PyLoad, then run it, a quick example import traceback from pyrx_impx import Rx, Ge, Gi, Db, Ap, Ed, Ax #creates a new command xdoit1 def PyRxCmd_xdoit1(): try: theApp = Ax.getApp() doc = theApp.ActiveDocument blk = doc.Blocks.Add([0, 0, 0], "MYBLOCK") blk.AddAttribute( 1, Ax.constants.acAttributeModeVerify, "New Prompt", [0, 0, 0], "NEW_TAG", "New Value", ) except Exception as err: traceback.print_exception(err)
    1 point
  20. Do not agreed with you The Earth is so small, take a look on map - just 5-6 thousand of miles or so Here is edited version This will create the new text entity with the same properties as the first selected text has (defun C:STX (/ cpent elist en ip newtxt pt ss sum sumtxt txt) (princ "\n\t\t>>> Select text to get summ >>>") (if ;;select texts/mtexts on screen : (setq ss (ssget '((0 . "*TEXT")))) ;; if selected then : (progn ;; store the first text entity for using 'em further : (setq cpent (ssname ss 0)) ;; set initial sum to zero : (setq sum 0.) ;; loop trough selected texts/mtexts : (while ;; get the first text in selection : (setq en (ssname ss 0)) ;; get entity list of them : (setq elist (entget en)) ;; get the textstring by key 1 from entity list : (setq txt (cdr (assoc 1 elist))) ;; create output string : (setq sumtxt ;; concatenate strings : (strcat ;; convert digits to string : (rtos ;; add to summ the digital value of text : (setq sum (+ (atof txt) sum)) ;; 2 is for metric units (3 for engineering) : 2 ;; set precision by current : (getvar "dimdec"))) ) ;; delete entity from selection set : (ssdel en ss) ) ;; display message in the command line: (princ (strcat "\nSumm=" sumtxt)) (setq pt (getpoint "\nSpecify the new text location: ")) ;; get the insertion point of stored entity : (setq ip (cdr (assoc 10 (entget cpent)))) ;; copy text entity to the new destination point : (command "_copy" cpent "" ip pt) ;; get the last created entity : (setq newtxt (entlast)) ;; get entity list of them : (setq elist (entget newtxt)) ;; modify entity list with new text string : (entmod (subst (cons 1 sumtxt)(assoc 1 elist) elist)) ;; update changes : (entupd newtxt) ) ) (princ) ) (princ "\nStart command with STX...") (princ) ~'J'~
    1 point
×
×
  • Create New...