Jump to content

Leaderboard

Popular Content

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

  1. @Steven P Thanks a lot. This code works! This string opens the file .dwg (startapp "explorer" (strcat "/e,\"" (vl-string-right-trim "\\" "D:\\Work24\\Office3.dwg\\") "\""))
    1 point
  2. Try this syntax, the code will open windows explorer in the folder you specify. In the file path the \ needs to be double \\, a single \ indicates that the next character is a specail character, so have to be doubled to be a \ (and if you ever want double \\, it is entered as \\\\) Don't need drawing name and file path at the end Got to check that you have the right number of pairs of ", (startapp "explorer" (strcat "/e,\"" (vl-string-right-trim "\\" "C:\\Users\\WhoAmI\\temp\\") "\""))
    1 point
  3. your shameless self-plug is certainly the closest I've been able to get so far. It's slightly more legwork than I had dreamt up, BUT it can absolutely be templatized in my workflow. Expect a full-version purchase soon.
    1 point
  4. I thought I would post the Drawing to DXF batch converter, as well as the others I have worked on. All thanks go to the originator and the others that have made modifications and updates, I did very little. I think some of these need cleaning up, but as far as I can tell, they get the job done. I had need to convert folders of .dwg's to .dxf's for use on a waterjet, etc. that best use version 2000 so it converts to DXF2000. Easy enough to modify for current version or any other if needed. ;;;|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ;;; | ;;;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<Modified to Batch Convert AutoCAD® DWG *.dwg into DXF *.dxf>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>| ;;; | ;;;|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ;;; | ;;; Original versions I got from here | ;;; https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/batch-convert-dgn-to-dwg/td-p/3237978 | ;;; | ;;;|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ;;; ;;;* DGNIMPORT.LSP - Converts a list of Microstation *.dgn drawings into AutoCAD *.dwg drawings ;;; Start command by typing DGNI ;;; ;;; Make the necessary adjustments to the following variables: ;;; --------------------------------------------------------- ;;; tx1 = path and name of a file that holds a list with names for all the *.dgn's to be imported, ;;; names of *.dgn drawings may be written without extension, as well as with extension, ;;; in plain text format, no return after the last line. ;;; tx2 = the path for the input folder, containing the actual *.dgn files to import. ;;; tx3 = the path for the output folder, where the drawings converted into *.dwg will be saved, ;;; (routine assumes that the *.dwg files do not exist yet) ;;; tx4 = name of the drawing model to import ;;; ;;; ;;; The routine reads drawing names from the file given in tx1 line-for-line. ;;; In each loop it performs a DGNIMPORT from the folder given as tx2 into the existing AutoCAD drawing, ;;; does a Zoom Extends, saves the converted drawing result as *.dwg in the folder given as tx3, ;;; and finally restores the drawing to its original state, ready to receive the next DGNIMPORT loop. ;;; ;;; The DELAY command for 1000 milliseconds (1 second) is needed to provide sufficient separation ;;; between the DGNIMPORT and SAVEAS processes (otherwise it starts to mix up drawings). ;;; ;;; The DGNIMPORT command trips when the name of the *.dgn to be imported contains a comma, ;;; I advise to rename drawings having this issue. ;;; ;;; Written by M. Moolhuysen. Modified by C. Matthews ;;; ;;; Modified by Cage Here https://www.cadtutor.net/forum/topic/78123-batch-convert-acis-sat-to-dwg/#comment-624627 ;;; ;;; This software may not be sold as commercial product or included as part of a commercial product. ;;; ;;; ;;;************************************************************************************************************************ ;;;************************************************************************************************************************ ;;; * ;;; Converts a folder of AutoCAD® DWG *.dwg drawings into DXF *.dxf drawings (Version 2000) * ;;; * ;;; Start command by typing DWG2DXF * ;;; * ;;; Modified by SLW210 A.K.A. Steve Wilson from DGNIMPORT to DWG2DXF 01/31/2024 * ;;; * ;;;************************************************************************************************************************ ;;;************************************************************************************************************************ (defun C:DWG2DXF (/ fil tx1 tx2 tx3 tx4 tx5) (princ "Please select input folder. \n") (setq tx1 (vl-directory-files (setq tx2 (acet-ui-pickdir)) "*.dwg")) ; Select the folder containing *.dwg files to be imported. (princ "Please select output folder. \n") (setq tx3 (acet-ui-pickdir) ; Select folder for the *.dxf files to be exported into. tx4 "Default" ) (setvar "FILEDIA" 0) (foreach tx5 tx1 (if (wcmatch tx5 "*`.???") (setq tx5 (substr tx5 1 (- (strlen tx5) 4))) ) (command "_UNDO" "_MARK" "OPEN" "" (strcat tx2 "\\" tx5) tx4 "" "" "_ZOOM" "_E" "._DELAY" 500 "_SAVEAS" "D" "V" "2000" "16" (strcat tx3 "\\" tx5 ".dxf") "_N" ) (command "_ERASE" "ALL" "") ;erases everything on the page after the save (command "_.purge" "_all" "" "_no") ;purges everything so you don't carry it over to the next drawing (command "_.purge" "_regapp" "" "_no") (command "_QNEW") ;opens a new drawing (setvar "FILEDIA" 0) ) (princ) ) DWG2DXF.lsp DXF2DWG.lsp DGN to DWG v2.lsp SAT2DWGv2.lsp
    1 point
  5. Maybe this, it opens C drive, you add your folder path, but be sure it is correct, best way is to copy path from file explorer and add correct backslashes (startapp (strcat "EXPLORER /e," "C:\\"))
    1 point
  6. thanks, @Steven P Unfortunately, nothing has changed... Whatever the path is, the first open folder opens... AutoCAD does not see the path...
    1 point
  7. Not sure if this will help you, it opens the current drawings folder: (defun c:GetFolder( / ) ;;opens the current drawing folder (startapp "explorer" (strcat "/e,\"" (vl-string-right-trim "\\" (getvar 'dwgprefix)) "\"")) (princ) ) You can put the file path that you want to use instead of (strcat......)
    1 point
  8. Cool, I saved this one. I just added a couple lines for settings. @cooldude224 My edit should help you with the position of the attribute (defun c:add_ATT (/ ss blk blk-lst atts-lst def AttObj obj2 text_height ip mode align) ;; settings. Feel free to adapt to your needs. ;; Feel free to change the settings from hard coded to user input. See below (setq text_height 2.5) (setq ip (list 0.0 0.0)) ;; insert point in the block (setq default_value "") ;; MODE: ;; (any combination of constants can be used by adding them together): ;; acAttributeModeNormal ;; acAttributeModeInvisible ;; acAttributeModeConstant ;; acAttributeModeVerify ;; acAttributeModePreset (setq mode acAttributeModeNormal) ;; Allignment: ;; acAlignmentLeft / acAlignmentCenter / acAlignmentRight / acAlignmentAligned / acAlignmentMiddle / acAlignmentFit / acAlignmentTopLeft / acAlignmentTopCenter / acAlignmentTopRight / acAlignmentMiddleLeft / acAlignmentMiddleCenter / acAlignmentMiddleRight / acAlignmentBottomLeft / acAlignmentBottomCenter / acAlignmentBottomRight (setq align acAlignmentRight) ;; COMMENT OUT THESE NEXT LINES IF YOU WANT THE HARD CODED SETTINGS (setq text_height (getdist "\nText height: ")) (setq ip (getpoint "\nInsert point: ")) (setq default_value (getstring "\nDefault value: " T)) (vl-load-com) (setq Tag (strcase (getstring "\nSpecify attribute tag: "))) (if (setq ss (ssget '((0 . "INSERT")))) ;change if to while repeats command if you keep selecting things (foreach e (vl-remove-if 'listp (mapcar 'cadr (ssnamex SS))) ;makes a list of all entitys by ename in selection set and steps thought them one at a time (setq blk (cdr (assoc 2 (entget e)))) (if (not (vl-position blk blk-lst)) (progn (setq blk-lst (cons blk blk-lst)) (setq obj2 (vlax-ename->vla-object e)) (setq atts-lst nil) ;clear list from last use (if (= (vla-get-hasattributes obj2) :vlax-true) (foreach att (vlax-invoke obj2 'getattributes) (setq atts-lst (cons (strcase (vla-get-tagstring att)) atts-lst)) ;make a list of all Attributs tag names to check rather then checking them all individually ) ;;close foreach ) ;;close if (if (not (member tag atts-lst)) ;checks list for "SYSTEM" could also use vl-position (progn (setq def (vla-item (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))) blk)) ;; VL : RetVal = (vla-AddAtribute object Height Mode Prompt InsertionPoint Tag Value) (setq AttObj (vla-addattribute def text_height mode "" (vlax-3D-point ip) TAG default_value)) (vlax-put AttObj 'Alignment align) (vla-move AttObj (vlax-3D-point (list 0.0 0.0)) (vlax-3D-point ip)) (command "_.attsync" "_N" blk) ) ;;close progn ) ;;close if ) ;;close progn ) ;;close if ) ;;close foreach ) ;;close if (princ) )
    1 point
  9. Thank you! This helps a lot, the hardest part I think is going to be getting the attribute in a position on the block that works. I need it to be right above another attribute I have visible. This is a very good starting point though so thanks again for sharing.
    1 point
  10. see if the attached lisp helps. add_ATT.lsp Aridzv.
    1 point
  11. this might be of interest https://www.theswamp.org/index.php?topic=59145.msg618669#msg618669 ^ I intend to publish this as open source edit, as a shameless plug, here's a Excel field evaluator, the free version doesn't expire and will let you evaluate like 30 fields. https://apps.autodesk.com/ACD/en/Detail/Index?id=4446191126131749248&appLang=en&os=Win64
    1 point
  12. I have another trying to find it, if you use VLA-Offset you can supply +ve and -ve values so will go left and right without need for direction pick, with open plines and lines select near an end implies the direction of the linework so goes right with +ve values. Arcs and circles reduce or increase radius.
    1 point
  13. A suggestion if labels were block attributes with insertion point on pline. a bit easier to work with, but you have 2 blocks so ignore text and use the blocks. AeccTickLine & AeccTickCircle then just use getdistatpoint. If you use Civil software the alignment stationing would be automatic. Output to a table again is built in. Will add to my To do list.
    1 point
  14. I would just like to give back a li I learnt from other people over the years. No more, no less.
    1 point
  15. 1 point
×
×
  • Create New...