Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/24/2021 in all areas

  1. You need to use a lisp that does arithmetic on the text in the drawing. If your text is in the correct format, it should take but a few seconds. Firstly, I would suggest you start with Lee Mac's web site and look at TextCalculator programme.
    1 point
  2. Setting excel range or cell properties is done using the 'vlax-put-property' command. MS Excel VBA online help is your friend for finding the names of properties of the Range or Cell object, and of the many enumerations used in Excel. See attached code snippet (part of a larger routine that inserts and formats a list of data into a specified Worksheet at the specified row and column) ; Data type codes ; vlax-make-variant constants ; https://documentation.help/AutoLISP-Functions/WS1a9193826455f5ff1a32d8d10ebc6b7ccc-6806.htm ; Some codes Empty = 0, Null = 1, Integer = 2, Long = 3, Single = 4, Double = 5, String = 8, Object = 9, Boolean = 11 (cond ((eq DataType "R") (setq TypeCode 5)) ; vlax-vbDouble ((eq DataType "I") (setq TypeCode 3)) ; vlax-vbLong ((eq DataType "S") (setq TypeCode 8)) ; vlax-vbString ) ; Justification ;https://docs.microsoft.com/en-us/office/vba/api/excel.xlhalign (cond ((eq DataJust "L") (setq JustCode -4131)) ; xlLeft ((eq DataJust "C") (setq JustCode -4108)) ; xlCenter ((eq DataJust "R") (setq JustCode -4152)) ; xlRight ) (setq xlcell nil) (setq xlcell (xlgetcellrange MySheet CellIndex)) ; Format. Specify this first so that any Text strings do not get covnerted to numbers my mistake (e.g. Handle '20e87', excel will try to converr to real 2.0e88 (if DataFormat (vlax-put-property xlcell "NumberFormat" DataFormat) ) ; Data type (cond ((member DataType (list "R" "I" "S")) (vlax-put-property xlcell 'value2 (vlax-make-variant DataValue TypeCode)) ) ((eq DataType "F") (vlax-put-property xlcell "Formula" DataValue) ) ) ; Justification (if DataJust (vlax-put-property xlcell "HorizontalAlignment" JustCode) ) ; Font bolding (setq MyFont (vlax-get-property xlcell "Font")) (cond ((eq FontBold 1) (vlax-put-property MyFont "Bold" (vlax-make-variant 1 11))) ; boolean 1=true ((eq FontBold 0) (vlax-put-property MyFont "Bold" (vlax-make-variant 0 11))) ; boolean 0=false ) ; Colour (if CellColourIndex (vlax-put-property (vlax-get-property xlcell "Interior") "Colorindex" (vlax-make-variant CellColourIndex)) )
    1 point
  3. Lines, polylines have a direction. You can draw a line from left to right, or from right to left. Just like polylines have an order of which point came first ... Depending on that the offset can do the opposite thing, depending on whether the distance is positive or negative. Test my code (type a number for getdist instead of setting two points) on the dwg I uploaded. ;; Custom OFFset (defun c:coff ( / mspace myline dist offLine) (vl-load-com) (setq mspace (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object)))) (setq myline (vlax-ename->vla-object (car (entsel "\nSelect object to offset: " )))) (setq dist (getdist "\nOffset Distance : ")) (setq offLine (vla-Offset myline dist)) (princ) ) (princ) offset.dwg
    1 point
  4. Look around your house/apartment. What do you see? OBJECTS! Anything you can pick up and actually measure can be used as the inspiration for creating a drawing in AutoCAD. Start small then work your way up to larger objects. Another option would be to go to your local library (remember those?) and check out a book about drafting. It should have plenty of examples of items that you can draw. Use your imagination!
    1 point
  5. There has been a lot of process multiple dwgs this may be useful to create a bat file using RLX code as a start but processing a file of dwg names, you would replace the hard code path with the path from select a folder. Adding /S will give subfolders as well. (command "shell" "dir D:\\acadtemp\\*.dwg /b >d:\\acadtemp\\dirdwg.txt" ) Also Pairing scripts to be run on associated drawings and batch processing (theswamp.org)
    1 point
  6. look up snvalid and you'll find that not all characters are allowed (\\<>/?\":;*|,=`) so * symbol is a no-no only way to fix this is to change the block or replace invalid characters with underscore or any other valid character. You can change (snvalid tag1) (snvalid tag2) in program with alternative version (validsn tag1) (validsn tag2) and add this tiny lisp code to your program : ;;; test (validsn "abc") (validsn "a\\b<c>d/e?f\"g:h;i*j|k,l=m`n") (defun validsn ( s / n ) (if (and (= (type s) 'STR) (setq n (vl-string->list "\\<>/?\":;*|,=`"))) (apply 'strcat (mapcar '(lambda (x)(if (member x n) "_" (chr x))) (vl-string->list s))) nil))
    1 point
×
×
  • Create New...