Chuyển đến nội dung
Diễn đàn CADViet

nguyentuyen6

Nhà quảng cáo
  • Số lượng nội dung

    212
  • Đã tham gia

  • Lần ghé thăm cuối

  • Ngày trúng

    3

Bài đăng được đăng bởi nguyentuyen6


  1. Chào bác Bình!

    Lisp của bác chạy tốt nhưng đường line màu xanh bị thừa ra một đoạn. Sao em thử dùng (entget (car (entsel))) chọn đường line bất kì thì không thấy mã dxf 62 nhỉ mà dùng hàm (vla-get-color (vlax-ename->vla-object (car (entsel)))) thì nó toàn ra màu 256 bác nào có thể giải thích hộ vấn đề này được không.

     

    Các mã DXF lấy đc từ hàm entget thì e thấy mã 62 này chỉ xuất hiện khi mình đổi màu của đối tượng đó thôi. Còn khi mà để màu theo kiểu bylayer... thì nó sẽ ko có. thế nên nhiều líp muốn đổi màu của 1 đối tượng thì phải kiểm tra xem nó có mã 62 chưa. nếu có thì dùng bình thường như các mã khác. Nếu chưa có thì dùng hàm cons để thêm mã 62 này vào trong cái list có đc từ hàm entget.

    • Vote tăng 1

  2. Hiện giờ tôi không có cad 2007 nên không biết chính xác lỗi đuợc. Hôm qua tôi đã thử chạy trên cad 2007 thì đuợc.

     

    nguyentuyen6 thử chạy lại với file cad "Drawing List.dwg" trong file đính kèm, nhớ để TableStyle hiện hành là CadViet, sau khi chạy xong mới đổi TableStyle xem sao ?

    (nhiều khả năng là do lỗi này ?)

     

    Hì !!! chào bác gia_bach. em vừa thử lại thì lại chạy ngon bác ạ. Còn vụ font thì phải vào trong TableStyle chỉnh thì nó mới đúng. Cảm ơn bác nhiều lắm!!!!


  3. Chào thiep

    Vấn đề ở Cad 2007 là do hàm vla-MergeCells :

    - Cad 2007 bị lỗi khi gọi (vla-MergeCells TblObj 0 0 0 col)

     

    - khắc phục bằng cách bẫy lỗi :

    (vl-catch-all-error-p (vl-catch-all-apply (function(lambda () (vla-MergeCells TblObj 0 0 0 col)) )))

    Cám ơn nhiều.

    Update Lisp thống kê bản vẽ

    (fix lỗi trong CAD 2007)

     

    link download here

     

    Em vừa dùng thử trên cad 2007 thì không tạo đc bảng bác ạ. ấn tạo bảng nó không hiện lên gì cả.Khi dùng trên 2008 thì tốt nhưng sao e đã để font mặc định là font của các tag cần thống kê mà nó vẫn lỗi font. phải vào bảng chỉnh lại font thì nó mới ra đúng. Thank


  4. ai biết cách hay có lisp nào vẽ được đường chân công trình nhanh không,(chân của mái đào hoặc mái đắp).đầu bài cho( tim công trình,cao trình và chiều rộng đỉnh,hệ số mài đào hoặc đắp cả thượng và hạ,cao trình và chiều rộng cơ hạ,thượng (nếu có), và một bình đồ,thank

    Bạn gửi File cad cái bạn muốn lên thì mọi người dễ giúp bạn hơn!!


  5. Về trình độ lisp thì em quá gà. Các bác gúp đỡ em viết 2 cái lisp rất đơn giản thế này thôi nhé

    1. vẽ hình chữ nhật: khi thực hiện lênh chương trình hỏi nhập chiều rộng (enter), nhập chiều dài (enter), sau đó pic 1 điểm -> vẽ hinh CN đó

    2. vẽ hình tròn: khi thực hiện lênh chương trình hỏi nhập bán kính (enter), sau đó pic 1 điểm -> vẽ hinh tròn đó

     

    thanks các cao thủ trước nha!!

     

    1. Vẽ hình vuông và hình chữ nhật

    2. Mình thấy Líp đâu có nhanh hơn lệnh đâu bạn????

     

    ; Ve hinh vuong: HV. Ve hinh chu nhat: HCN. Ve hinh tron : HT
    ;nguyentuyen6 @ CadViet
    ;=====================================================
    (defun c:hcn (/ dx dy pt1 pt2 ptg)
    (command "undo" "be")
    (setq OldEcho (getvar "cmdecho")) 
    (setvar "cmdecho" 0)
           (setq ptg (getpoint "\nDiem dat:"))
            (setq dx (getreal "\nRong:"))
            (setq dy (getreal "\nDai:"))
    (setq pt1 (polar ptg pi dx))
    (setq pt2 (polar pt1 (/ pi 2) dy))
    (setq ptc (acet-geom-midpoint ptg pt2))
      (reset)
    (command ".rectang" ptg pt2)
    (command ".move" (entlast) "" ptc ptg)
      (reset1)
    (setvar "cmdecho" OldEcho)
    (command "undo" "e")
            (princ)
      )
    ;=====================================================
    (defun c:hv (/ dx pt1 pt2 ptc)
    
    (command "undo" "be")
    (setq OldEcho (getvar "cmdecho")) 
    (setvar "cmdecho" 0)
    
           (setq ptg (getpoint "\nDiem dat:"))
    ;        (setq dx (getreal "\nDai canh:"))
    
    (setq
     daicanhhv (cond (daicanhhv) (220))
     daicanhhvold daicanhhv
     daicanhhv   (getreal (strcat "\nDai canh <"(rtos daicanhhvold 2 0)">: ")))
    (if (= daicanhhv nil) (setq daicanhhv daicanhhvold))
    
    
    
    (setq pt1 (polar ptg pi daicanhhv))
    (setq pt2 (polar pt1 (/ pi 2) daicanhhv))
    (setq ptc (acet-geom-midpoint ptg pt2))
      (reset)
    (command ".rectang" ptg pt2)
    (command ".move" (entlast) "" ptc ptg)
      (reset1)
    (setvar "cmdecho" OldEcho)
    (command "undo" "e")
            (princ)
      )
    ;=====================================================
    (defun c:ht (/ bankinh)
    (setq bankinh (getreal "\nBan kinh:"))
    (reset)
    (command ".circle" (getpoint "\nDat Tam:") bankinh)
    (reset1)
    (princ)
    )
    ;=====================================================
      (defun reset()
        (setq old_osm (getvar "osmode"))
        (setvar "osmode" 0)
        )
    ;---------------------------------------
        (defun reset1()
        (setvar "osmode" old_osm)
       )


  6. Lang thang nhặt được cái này.

     

    (defun acet-error-init ( errlist /                    ;;Error Init for ET
    (defun acet-error-restore ( /                         ;;Error Restore for ET
    (defun acet-sysvar-set ( varlist /                    ;;Save Sysvar List
    (defun acet-sysvar-restore ( /                        ;;Restore Sysvar List
    (defun acet-spinner ( /                               ;;Show Spinner Sign
    (defun acet-table-name-list ( tblORlist /             ;;Get Table Entries
    (defun acet-table-purge ( table entry flag /          ;;Purge table entry
    (defun acet::store2reg ( varname varval /             ;;Store custom data 2 Registry
    (defun acet::loadreg ( varname /                      ;;Load custom from Registry
    (defun acet::store2dict ( varname varval /            ;;Store custom data 2 Dict
    (defun acet::loaddict ( varname /                     ;;Load custom from Dict
    (defun acet-set-CmdEcho ( val                         ;;Setvar CmdEcho
    (defun acet-setvar ( varlist /                        ;;Setvar Custom Var
    (defun acet-group-make-anon ( enamelist desc /        ;;Create Anonymous Group
    (defun acet-ucs-to-object ( ent /                     ;;Setvar UCS to Ent
    (defun acet-ucs-set-z ( zvec /                        ;;Setvar UCS to Ent
    (defun acet-ucs-get ( from /                          ;;get current/entity ucs 
    (defun acet-ucs-set ( ucs / 
    (defun acet-ucs-cmd ( cmdlist /                       ;;execute ucs command
    (defun acet-xdata-set ( xkeylist /                    ;;Set XData Values for keys
    (defun acet-xdata-get ( xkeylist /                    ;;Get XData Value for key
    (defun bns_ss_mod ( ss flag pr /                      ;;Get XData Value for key
    (defun acet-layer-locked ( layer /                    ;;Check Layer Locked ?
    (defun acet-layer-unlock-all ( /                      ;;Unlock all layers
    (defun acet-plines-rebuild ( plist /                  ;;rebuild polylines
    (defun acet-pline-segment-list-apply ( na lst /       ;;re-apply pline segment width
    (defun acet::apply_width_bulge ( na swlst ewlst blglst / 
    (defun acet-plines-explode ( ss /                     ;;explode polylines
    (defun acet-pline-segment-list ( elist /              ;get pline segment data
    (defun acet::plines-get-widthlist ( ename etype elist / 
    (defun acet::pline-explode ( ename / 
    (defun acet-ss-ssget-filter ( ss flt /                ;;filter selection set
    (defun acet-ss-new ( ename /                          ;;Create new SelectionSet with Ent
    (defun acet-ss-clear-prev ( /                         ;;Clear previous SelectionSet
    (defun acet-ss-visible ( entset flag /                ;;Make Entities Visible(0)-Invisible(1)
    (defun acet-ss-intersection ( ss ssmaster /           ;;SelectionSet Intersection
    (defun acet-ss-filter ( filterdata /                  ;;Filter Selection Set
    (defun acet-ss-flt-cspace ( /                         ;;Build filter part for current space
    (defun acet-ss-remove ( ss ssmaster /                 ;;Remove Ents from SelectionSet
    (defun acet-ss-union ( sslist /                       ;;Combine SelectionSets together
    (defun acet-ss-redraw ( ss mode /                     ;;Redraw SelectionSet with Mode
    (defun acet-list-m-assoc ( key datalist /             ;;Redraw SelectionSet with Mode
    (defun acet-ss-entdel ( ss /                          ;;Entdel ss entities
    (defun acet-ss-filter-current-ucs ( ss printit /      ;;filter entities on current ucs
    (defun acet-ss-annotation-filter ( ss / 
    (defun bns_annotation_ss ( ss /                       ;;Get Attributes into ss, remove inserts
    (defun acet-ss-to-list ( ss /                         ;;Convert selection-set to entities list
    (defun acet-list-to-ss ( lst /                        ;;Convert entities list to selection-set
    (defun acet-ss-zoom-extents ( ss /                    ;####### Punkte p1/p2 von entry ohne Z-Wert !!!
    (defun acet-ss-remove-dups ( ss fuz ignore /          ;;Remove duplicate entities
    (defun acet::check-identic-points ( plist1 plist2 fuz / 
    (defun acet-tjust-keyword ( elist /                   ;;get text justification
    (defun acet-tjust ( ss tjust /                        ;;(acet-tjust (ssadd na (ssadd)) "Start") ;
    ; then set it to start
    (defun acet-insert-attrib-set ( na attlst flag /  
    (defun acet-currentviewport-ename ( /                 ;get current vport entity
    (defun acet-viewport-lock-set ( vpename setlocked /   ;set vport locked/unlocked
    (defun acet-alert ( msg / 
    (defun acet-fscreen-toggle ( / 
    (defun acet-init-fas-lib ( flag1 flag2 / 
    (defun acet-block-make-anon ( ss blkname /            ;;Create anonymous block from ss
    (defun acet-block-purge ( bna /                       ;;Purge Block with given name
    (defun getgeomextents ( en / 
    (defun acet-geom-z-axis ( / 
    (defun acet-point-flat ( pt from to /                 ;;flat point
    (defun acet-geom-midpoint ( p1 p2 /                   ;;Calculate Midpoint for P1,P2
    (defun acet-geom-m-trans ( pntlst from to /           ;;Transform Pointlist
    (defun acet-geom-list-extents ( pntlst /              ;;Transform Pointlist
    (defun acet-geom-zoom-for-select ( pntlist /          ;;Get Zoom Points to Include Points
    (defun acet-geom-view-points ( /                      ;;Get Viewport Corner Points
    (defun acet-geom-pixel-unit ( / 
    (defun acet-geom-textbox ( txtdata offset /           ;;Get Textbox for any Text
    (defun acet-geom-rect-points ( pa pb /                ;;Get 5 Rectangle Points
    (defun acet-geom-self-intersect ( pointlist flag /    ;;Point Check Self-Intersection
    (defun acet-geom-object-end-points ( ename /          ;;get object end points
    (defun acet-geom-object-point-list ( na alt /         ;;Get Object Points Rasterized    
    ;; altitude may be NIL !
    (defun acet::[b]Pl-point-list[/b] ( na alt /                 ;;Get Polyline/LwPolyline Points
    (defun acet::arc-point-list ( p1 p2 p3 ang alt /      ;;Get Arcus Points
    (defun acet::delta-ang ( r a /                        ;;Get Arcus Infos  
    ;returns the delta angle of an arc with the specified altitude and radius
    (defun acet-geom-image-bounds ( na /                  ;;Get Image Bounds
    (defun acet-geom-point-rotate ( pnt p1 ang /          ;;Rotate Point ;Rotate 'pnt' from a 
    ;base point of 'p1' and through an angle of 'ang' (in radians)
    (defun acet-geom-vertex-list ( na /                   ;;Get (LW)Polyline Vertexes
    (defun acet-geom-delta-vector ( p1 p2 /               ;;Get Difference Vector
    (defun acet-geom-vector-scale ( vec scale /           ;;Get Difference Vector
    (defun acet-geom-vector-add ( vec add /               ;;Add 2 Vectors
    (defun acet-geom-cross-product ( v1 v2 /              ;;Get Vector Cross Product (Normal Vector)
    (defun acet-geom-unit-vector ( p1 p2 /                ;;Get Vector Normalized
    (defun acet-geom-angle-trans ( ang from to /          ;;Transform Angle between Coordsys
    (defun acet-geom-pline-arc-info ( p1 p2 bulge /       ;;Get Arcus Infos
    (defun acet-geom-point-inside ( pt ptlist dist /      ;;Check Point inside Band along Ptlist
    (defun acet-geom-vector-side ( pt pa pb /             ;;Get Side of Point rel. to Vector
    (defun acet-geom-intersectwith ( ent1 ent2 flag /     ;;Get Intersection Points
    (defun acet::measure-points ( object dist /           ;;Get Object points by Measure
    (defun acet-geom-object-normal-vector ( ename /       ;;Get Entity's Z normal vector
    (defun acet-geom-point-scale ( targetpnt frompnt scale / 
    (defun acet-geom-vector-parallel ( v1 v2 /            ;;Check for parallel vectors
    (defun acet-geom-arc-center ( pa pb pc /              ;;Get Arc center from 3 points
    (defun acet-geom-object-z-axis ( ename /              ;;Get Entity Z-Axis
    (defun acet-geom-vector-d-angle ( v1 v2 /             ;;Get angle between 2 vectors
    (defun acet::acos ( inval / 
    (defun acet-geom-object-fuz ( na /                    ;;Get object fuzz
    (defun acet-ui-entsel ( sellst /                      ;;Entity Selection
    (defun acet-ui-single-select ( filter flag /          ;;Single Entity Select
    (defun acet-ui-fence-select ( /                       ;;Fence Selectino points
    (defun acet-ui-polygon-select ( mode /                ;;Window/Crossing Polygon
    (defun bns_truncate_2_view ( a b x y x2 y2 /          ;;Truncate point list
    (defun bns_groups_unsel ( /                           ;;Set All Groups to Unselect
    (defun bns_groups_sel ( grpenames /                   ;;Set Groups back to Select
    (defun acet-blink-and-show-object ( lst /             ;;Draw a temporary polyline & let it blink
    (defun bns_blink_and_show_object ( na color /         ;;Draw a temporary polyline & let it blink
    (defun bns_blktbl_match ( flt /                       ;;Search all entities inside block table
    (defun bns_blk_match ( blkname flt lst flag /         ;;Search all entities inside specified blocks
    (defun bns_tbl_match ( tblname flt /                  ;;Search all entities inside specified blocks
    (defun bns_filter_match ( e1 flt / 
    (defun bns_-4_match ( a e1 flt / 
    (defun bns_or_match ( e1 flt / 
    (defun bns_and_match ( e1 flt / 
    (defun bns_not_match ( e1 flt / lst a flag )
    (defun bns_gc_match ( e1 dp opr / dp2 a b c d flag )
    (defun acet-dcl-list-make ( dcltile vallist /         ;;Display List Values
    (defun acet-list-put-nth ( newval datalist atidx / 
    (defun acet-list-remove-nth ( atidx datalist /        ;;Remove Entry at Index
    (defun acet-list-assoc-remove ( key datalist /        ;;Remove all Entries by Key
    (defun acet-list-remove-adjacent-dups ( datalist /    ;;Remove Duplicates from List
    (defun acet-list-remove-duplicate-points ( lst fuz /  ;;Remove duplicate points from List
    (defun acet-list-group-by-assoc ( lst /               ;; group data by assoc key
    (defun acet-elist-add-defaults ( elist /              ;;add defaults to elist
    (defun acet-str-lr-trim ( s str /                     ;;Trim Left / Right Characters
    (defun acet-str-space-trim ( str /                    ;;Trim Left / Right Spaces
    (defun acet-str-esc-wildcards ( str /                 ;;place escape for wildcard strings
    (defun acet-str-to-list ( deli line /                 ;;Split String into List
    (defun acet-str-m-find ( find str /                   ;;Find multiple Substrings
    (defun acet-str-equal ( str1 str2 /                   ;;Compare Strings Insensitive
    (defun acet-bs-strip ( str /                          ;;Remove backslash controls
    (defun acet-filename-ext-remove ( file /              ;;Remove Extension from File
    (defun acet-filename-path-remove ( file /             ;;Get Filename Without Path
    (defun acet-filename-extension ( file /               ;;Get Extension from Filename
    (defun acet-filename-directory ( file /               ;;Get Directory from Filename
    (defun acet-filename-valid ( file /                   ;;Check for Proper Filename
    (defun acet-filename-supportpath-remove ( file /      ;;Remove Path, if file is inside Supportpathes
    (defun acet-file-find ( file /                        ;;Extended FindFile
    (defun acet-file-find-font ( fontfile /               ;;Extended FindFile (Fonts)
    (defun acet-file-find-image ( imgfile /               ;;Extended FindFile (Fonts)
    (defun acet-file-backup ( file /                      ;;Create Backup file
    (defun acet-file-backup-delete ( /                    ;;Delete All Backup files
    (defun acet-filename-associated-app ( filename /      ;;Get Application for file
    (defun get-defparts ( cmd / cmdname cmdpar idx slen )
    (defun acet-arxload-or-bust ( filename / 
    (defun acet-autoload ( loadlist /                     ;;Test & Load function & file
    (defun acet-autoload2 ( loadlist / 
    (defun acet-autoloadarx ( loadlist / 
    (defun acet-viewport-next-pickable ( /                ;;Get Next Pickable VP
    (defun acet-viewport-frozen-layer-list ( ename /      ;;Get Next Pickable VP
    (defun acet-calc-bitlist ( n /                        ;;Calculate Bit Values
    (defun acet-calc-round ( rval rround /                ;;Round Value
    (defun acet-calc-tan ( a /                            ;; Calculate Tangens
    (defun acet-lwpline-make ( lst /                      ;;Create LW Polyline
    (defun acet-temp-segment ( p1 p2 p3 mode /            ;;Draw tempory Segment
    (defun acet-wmfin ( wmffile /                         ;;WMF IN
    (defun acet-dxf ( key keylist /                       ;;Get dxf value from assoc list
    (defun acet-angle-format ( ang /                      ;;format angle 0...2*PI
    (defun acet-angle-equal ( a b fuz /                   ;;Compare Angles with Tolerance
    (defun acet-dtor ( a /                                ;;Compare Degree <> Radians
    (defun acet-rtod ( a /                                
    (defun acet-dict-ename ( dictname dictentry /         ;;Get Dictionary entry
    (defun acet-dict-name-list ( dictname /               ;;Get Dictionary entries
    (defun acet-explode ( na /                            ;;Explode SS and return exploded entities
    (defun acet-list-assoc-put ( new lst /                ;;Add / Update entry to list
    (defun acet-list-assoc-append ( new lst /             ;;Append entry to list
    (defun acet-pline-is-2d ( elist /                     ;;Check (LW)Polyline for 2D
    (defun acet-ui-getcorner ( p1 /                       ;;Get other corner with selection rubberband
    (defun acet-undo-begin ( /                            ;;undo begin
    (defun acet-undo-end ( /                              ;;undo end
    (defun acet-cmd-exit ( /                              ;;undo command exit
    (defun acet-safe-command ( bStart bAutoEnd cmdList /  ;;execute commands in safe mode
    (defun acet-pref-supportpath-list ( /                 ;;Get Support Pathes as list
    (defun acet-list-isort ( plst index /                 ;;Indexed Sort
    (defun acet-acad-refresh ( / 
    (defun acet-geom-ss-extents ( ss shrink /             ;;Get extents of selection set
    (defun acet-file-find-on-path ( fna path /            ;;Find file on OS env "PATH"
    (defun acet-list-is-dotted-pair ( a /                 ;;check for dotted pair
    (defun acet-file-open ( fna flag /                    ;;file open
    (defun acet-list-remove-duplicates ( lst fuz /        ;;remove duplicates from list
    (defun acet-list-split ( lst item /                   ;;Split List at entry
    (defun acet-appid-delete ( appid /                    ;;Remove APPID
    (defun acet-ui-progress-init ( title maxstep /        ;;init progress bar
    (defun acet-ui-progress-safe ( pos /                  ;;set progress pos
    (defun acet-ui-progress-done ( /                      ;;done progress
    (defun acet-ui-get-long-name ( msg /                  ;;get long keyboard input
    (defun acet::getltexmsg ( msgkey defmsg / 
    (defun acet::expandfn ( fname fcheck /                ;;Expand & Find Filename
    (defun acet::filetype ( filename /                    ;;Get File Type Only
    (defun acet::pos-filetype ( filename /                ;;Get Position of Extension
    (defun acet::nameonly ( filename /                    ;;Get File Without Path
    (defun acet::pathonly ( filename /                    ;;Get Directory only[/font]

    • Vote tăng 5

  7. e vẽ cad nhiều rùi nhưng ít khi đc íncước ông sếp bảo in bản vẽ cho ông ấy mình cũng in ra bình thường nhưng khi xem lão nhăn nhó bảo sao ko đặt nét khi in? mình ko biết đặt thế nào ai bít chỉ dùm e với. khi vẽ thi mình đã dặt kích thước đường trong Layer rùi.

     

    Nếu bạn đặt nét theo layer rồi thì vào đây chỉnh xem sao nhé:

    Trong bảng Print:

     

    untitled_28.jpg


  8. Bạn THANHBIH oi! help mình với.Mình gặp rắc rối về bock.Mình tạo 1 block thì khi tạo xong cai bock đó lập tức biến mất.vậy nghĩa là sao hả bạn.Bị lỗi gì thế ThanhBình

    Nêu bạn tạo block = lisp thì sau khi tạo phải thêm 1 bước insert nữa:

     

    VD:

    (command "_.BLOCK" tenblock diemchen doituongtaoblock ""

    "_.INSERT" tenblock diemchen 1 1 0)


  9. mình đang muốn học một phần mềm hỗ trợ vẽ 3d tốt nhưng nhiều wá nên ko biết phần mềm nào hỗ trợ vẽ 3d tốt nhất, mong các bạn giúp đỡ, thanks ( trừ phần mềm autocad ). thanks

    Cái nào tốt nhất thì mình chịu chả dám bàn luận. Nếu bạn làm thiết kế kiến trúc thì mình thấy p/m SketchUp là một lựa chọn rất tốt. Dựng hình trực quan mà lại rất nhanh. học cũng dễ. he he


  10. Có bác nào sử dụng lệnh SPLine không cho em hỏi chút.Em biết lệnh spline nhưng khi vận dụng nó em thấy khó quá.Em vẽ một hình vòm mà nó không thành ,nó cứ cong vênh chẳng ra hình thù nào cả.Ai biết giúp em với. :)

    Cái lệnh này cũng khó vẽ chính xác lắm. Phần lớn mình vẽ là theo cảm tính, thấy tương đối cx là đc. còn hình vòm thì tốt nhất bạn vẽ 1 nửa rồi mirror cho nhanh. muốn vẽ cân nó thì các điểm pick của nó phải đối xứng nhau qua 1 trục


  11. Chào bạn nguyentuyen6

    Vì sao bạn không chọn biến sochia giống như đã làm với các số khác vì mình thấy trên bản vẽ của bạn van tu con số này cũng đã được cho trước rồi mà????

    Kết quả khi tính theo phần trăm thì cái dòng code (vla-put-TextString ...... ) thứ hai của bạn mới là đúng.

    Chào bác thanhbinh!!

    Cái biến sochia e làm như vậy vì nghĩ : Có khi cái biến ấy chỉ cần nhập 1 lần rồi dùng chung cho tất cả các cái sau. Thì làm như vậy sẽ đỡ mất công pick nhiều lần, hi`hi`. E ko làm cái trắc ngang trăc dọc bao h nên cũng mù tịt chẳng hiểu gì về nó cả.

    Còn cái tính % thì em cũng nghĩ là dòng thứ 2 mới đúng nên vẫn để đó. Tại cái biểu thức bạn vantu gửi e cũng chả thấy cái x100 ở đâu nên cứ để tạm vào cho nó đúng yêu cầu. Đến khi bạn vantu test thử lisp này rồi cho ý kiến cũng dễ để sửa bác ạ.

    • Vote tăng 1

  12. Mình viết thử cái này xem đúng ý bạn không nhé. Chọn các số lần lượt như trong biểu thức của bạn gửi nhé!!!

    (defun c:dd (/ txt1 txt2 txt3 txt4 nametxt1 nametxt2 nametxt3 nametxt4 kqua obj)
    (vl-load-com)
    (setq txt1 (car (entsel "\nChon text1:"))
      nametxt1 (entget txt1)
         txt2 (car(entsel "\nChon text2:"))
      nametxt2 (entget txt2)
      txt3 (car(entsel "\nChon text3:"))
      nametxt3 (entget txt3)
      txt4 (car(entsel "\nChon text4:"))
      nametxt4 (entget txt4)	  
    kqua 0)
    ;=======
    (setq
    sochia (cond (sochia) (166))
    sochiaold sochia
    sochia (getreal (strcat "\nVao he so chia <"(rtos sochiaold 2 2)">: "))
    )
    (if (= sochia nil) (setq sochia sochiaold))
    ;=======
    
    (setq
    kqua 
    (- (- (atof (cdr (assoc 1 nametxt1))) (atof (cdr (assoc 1 nametxt2))))
      (- (atof (cdr (assoc 1 nametxt3))) (atof (cdr (assoc 1 nametxt4))))
    )
    )
    (setq kqua (/ kqua sochia))
    (princ kqua)
    
    (setq obj (vlax-ename->vla-object
    (car (entsel "\nChon text de ghi ket qua:"))
    )
    )
    (vla-put-TextString obj (strcat " "(rtos kqua 2 2)" %"))
    ;(vla-put-TextString obj (strcat " "(rtos (* kqua 100) 2 2)" %"))
    (princ)
    )


  13. Mình không biết có lệnh nào tự động ghi kích thước đoạn thẳng như file mình đính kèm không? Mình chỉ biết dùng lệnh dal, nhưng kích thước lại ghi không theo ý mình. Nhờ mọi người giúp nhé. Thanks.

     

    http://www.cadviet.com/upfiles/3/lisp_ve_t..._kich_thuoc.dwg

     

    Để ghi kích thước theo trục X hoặc Y thì bạn dùng lệnh DLI. còn theo các chiều khác thì mới dùng DAL

    • Vote tăng 1

  14. Chào mọi người trên diễn đàn!

    Hôm nay e có 1 yêu cầu nhờ mấy cao thủ trên diễn đàn giúp

     

    Tình hình là e nhờ mọi người viết giúp e 1 lisp với yêu cầu như sau:

    - Tự động chọn nhiều đối tượng (ssget 1 vùng đối tượng)

    - Xét từng đối tượng được chọn, tạo point tại các giao cắt của object. Ví dụ như hình vuông thì có 4 điểm giao cắt, tạo 4 point tại 4 điểm đó, tam giác thì có 3 điểm)

    - Lấy cao độ cácpoint vừa mới tạo ra tại các điêm giao cắt đó

     

    Mong mọi người trên diễn đàn viết giúp e

    Thanks & regard!!!

    Bạn Up file cad lên đây thì mọi người dễ giúp bạn hơn đấy.


  15. Cảm ơn ý kiến của bác. Ok nếu dùng hàm đó kiểm tra mà chưa có thì ok.

    Còn nếu mà có rùi thì em muốn nó ghi đè lên block đã có.Vậy thì làm thế nào nhỉ các bác.

    Em mới học lisp nên còn nhiều bỡ ngỡ mong các bác giúp.

    Hihi,Cảm ơn bác Tue đã nhắc nhở e

     

    Bạn thêm hàm kiểm tra này nhé:

     

    (if (not(tblsearch "block" ten) )

    (command "_.BLOCK" ten pt1 e2 e3 e4 e5 e6 ""

    "_.INSERT" ten pt1 1 1 0)

    (alert "\n Da trung ten Block")

    )

×