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

thanhduan2407

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

    1.161
  • Đã tham gia

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

  • Ngày trúng

    26

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


  1. Vào lúc 22/2/2024 tại 11:18, Doan Van Ha đã nói:

    Trước đây tôi có đọc 1 thuật toán để "xấp xỉ" các đường thẳng và đường cong, nhưng giờ quên và tìm lại chưa ra. Nó có cơ sở rất thuyết phục chứ không theo kiểu "thích gì chọn nấy" được.
    Thuật toán này trong Excel được đưa vào để vẽ đồ thị, từ đó suy ra phương trình, cho các bài toán dạng thống kê dựa vào tập hợp các số đo (xi, yi) thực nghiệm.

    Ngày xưa cháu học trong trường có môn gọi là "Phương pháp tính" cũng có thuật toán này. Nhưng lâu rồi (20 năm) nên cháu không nhớ


  2. Bản vẽ bạn gửi không cần lisp gì cả. Xuất toạ độ Point ra là có cao độ Z. Phun lại là xong.

    Nếu như Point hoặc Circle không có cao độ (khác 0 hoặc khác giá trị chuẩn nhưng không đều) thì mới cần đến việc viết theo yêu cầu. 

    Liên hệ mình Zalo: 0972.0168.25 để trao đổi thêm


  3. Bạn thử xem được không nhé!

    Yêu cầu cài Cad full (có tool express)

    (defun C:00	(/ LTSG LTSLINE PNTMAX PNTMIN SSLINE)
    	(defun *error* (msg)
    		(if	Olmode
    			(setvar 'osmode Olmode)
    		)
    		(if	(not (member msg '("*BREAK,*CANCEL*,*EXIT*")))
    			(princ (strcat "\nError: " msg))
    		)
    		(princ)
    	)
    	(setq Olmode (getvar "OSMODE"))
    	(setvar "OSMODE" 0)
    	(setvar "CMDECHO" 0)
    	(setq ssLine (ssget (list (cons 0 "LINE,LWPOLYLINE,POLYLINE"))))
    	(if	ssLine
    		(progn
    			(setq LtsLine (acet-ss-to-list ssLine))
    			(setq LtsG (LM:IntersectionsinList LtsLine))
    			(if	(= (length LtsG) 4)
    				(progn
    					(setq PntMin (list (apply 'min (mapcar 'car LtsG)) (apply 'min (mapcar 'cadr LtsG))))
    					(setq PntMax (list (apply 'max (mapcar 'car LtsG)) (apply 'max (mapcar 'cadr LtsG))))
    					(command "rectang" PntMin PntMax)
    					(vla-put-color (vlax-ename->vla-object (entlast)) 1)
    				)
    			)
    		)
    	)
    	(setvar "OSMODE" Olmode)
    	(princ)
    )
    
    
    
    (defun LM:Intersections	(obj1 obj2 mode / l r)
    	(setq l (vlax-invoke obj1 'intersectwith obj2 mode))
    	(repeat	(/ (length l) 3)
    		(setq	r	(cons (list (car l) (cadr l) (caddr l)) r)
    					l	(cdddr l)
    		)
    	)
    	(reverse r)
    )
    
    (defun LM:IntersectionsinList	(lst / a l)
    	(while (setq a (car lst))
    		(foreach b (setq lst (cdr lst))
    			(setq	l	(cons	(LM:Intersections
    											(vlax-ename->vla-object a)
    											(vlax-ename->vla-object b)
    											acextendnone
    										)
    										l
    							)
    			)
    		)
    	)
    	(apply 'append (reverse l))
    )
    
     

     

    • Vote tăng 1

  4. 8 giờ trước, anhGeodesy đã nói:

     

     

    Dear Bác @quocmanh04tt

    Hiện tại em đang cần món này, Vướng cái ContentType như hình dưới đây nhưng chưa biết cách Edit nó. nhờ bác chỉ giáo và Edit .

     

    
    (defun createmultileader (data $stylename / dic obj)
    
    (if (not (member $stylename
    
    (foreach lstnfo (dictsearch (namedobjdict) "ACAD_MLEADERSTYLE")
    
    (if (= 3 (car lstnfo))
    
    (if (not newlst)
    
    (setq newlst (list lstnfo))
    
    (setq newlst (append (list lstnfo) newlst)))))))
    
    (if (and (setq dic (dictsearch (namedobjdict) "ACAD_MLEADERSTYLE"))
    
    (setq dic (cdr (assoc -1 dic)))
    
    (setq obj (entmakex data)))
    
    (progn (dictremove dic $stylename) (dictadd dic $stylename obj))))
    
    (if (vl-catch-all-error-p (vl-catch-all-apply '(lambda () (vla-put-arrowsymbol $stylename "_Origin2"))))
    
    (not (vl-catch-all-error-p
    
    (vl-catch-all-apply '(lambda () (vla-put-arrowsymbol $stylename acarrowdefault)))))))
    
    (setq shtdata (list (cons 0 "MLEADERSTYLE")
    
    (cons 5 "362")
    
    (cons 102 "{ACAD_REACTORS")
    
    (cons 102 "}")
    
    (cons 100 "AcDbMLeaderStyle")
    
    (cons 179 2)
    
    (cons 170 1)
    
    (cons 171 1)
    
    (cons 172 0)
    
    (cons 90 2)
    
    (cons 40 0.0)
    
    (cons 41 3.14159)
    
    (cons 173 1)
    
    (cons 91 -1056964608)
    
    (cons 92 -2)
    
    (cons 290 1)
    
    (cons 42 2.0)
    
    (cons 291 1)
    
    (cons 43 750.0)
    
    (cons 3 "Standard")
    
    (cons 44 100.0)
    
    (cons 300 "")
    
    (cons 174 5)
    
    (cons 178 5)
    
    (cons 175 1)
    
    (cons 176 0)
    
    (cons 93 -1073741824)
    
    (cons 45 250.0)
    
    (cons 292 0)
    
    (cons 297 0)
    
    (cons 46 4.0)
    
    (cons 94 -1056964608)
    
    (cons 47 0.75)
    
    (cons 49 0.75)
    
    (cons 140 0.75)
    
    (cons 293 1)
    
    (cons 141 0.0)
    
    (cons 294 1)
    
    (cons 177 0)
    
    (cons 142 1.0)
    
    (cons 295 0)
    
    (cons 296 0)
    
    (cons 143 10.0)
    
    (cons 271 0)
    
    (cons 272 9)
    
    (cons 273 9)
    
    (cons 298 1)))
    
    (createmultileader shtdata "SHT")
    
    (princ))

     

    image.thumb.png.f7380c91a077bf9935b07b4442343c73.png

     

     

    Anh nghiên cứu cái này.

    (vla-put-contenttype mlo 2) => số 2 là Mtext, 1 là Block

    (cons 170 1) => (cons 170 2)

    (defun _makemleaderstyle (name txtstyle / d mld mlo)
      ;; RJP - 09.16.2017
      (if
        (and
          (setq d (vla-get-dictionaries (vla-get-activedocument (vlax-get-acad-object))))
          (= 'vla-object
    	 (type (setq mld (vl-catch-all-apply 'vla-item (list d "ACAD_MLEADERSTYLE"))))
          )
          (= 'vla-object
    	 (type
    	   (setq mlo (vl-catch-all-apply 'vlax-invoke (list mld 'addobject name "AcDbMLeaderStyle")))
    	 )
          )
        )
         (progn
           (vla-put-contenttype mlo 2)
           (vla-put-alignspace mlo 0.1)
           (vla-put-annotative mlo :vlax-true)
           (vla-put-arrowsize mlo 0.18)
           (vla-put-blockconnectiontype mlo 0)
           (vla-put-breaksize mlo 0.1)
           (vla-put-description mlo "")
           (vla-put-dogleglength mlo 0.125)
           (vla-put-enablelanding mlo :vlax-true)
           (vla-put-firstsegmentangleconstraint mlo 0)
           (vla-put-landinggap mlo 0.05)
           (vla-put-maxleadersegmentspoints mlo 2)
           (vla-put-scalefactor mlo 1)
           (vla-put-secondsegmentangleconstraint mlo 0)
           (vlax-put mlo 'textalignmenttype 0)
           (vlax-put mlo 'textleftattachmenttype 1)
           (vlax-put mlo 'textrightattachmenttype 1)
           (vla-put-textheight mlo 0.1)
           ;; Make sure you load your texstyle first or it will default to standard
           (vla-put-textstyle
    	 mlo
    	 (if (tblobjname "style" txtstyle)
    	   txtstyle
    	   "standard"
    	 )
           )
           mlo
         )
      )
    )

     

    • Vote tăng 1
×