Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/17/2019 in all areas

  1. (SetCustomDwgProp "Pages" "1") Will add only if necessary then set the Custom Property "n_project" to "IT.19.9655" using the following code. (defun getCustomDwgProp (key / app doc dwgprops try val) (vl-load-com) (setq App (vlax-Get-Acad-Object) Doc (vla-Get-ActiveDocument App) DwgProps (vla-Get-SummaryInfo Doc) ) (cond ((vl-catch-all-error-p (setq try (vl-catch-all-apply 'vla-GetCustomByKey (list DwgProps key 'val) ) ) ) (setq val nil) ) ) val ) (defun SetCustomDwgProp (key value / App Doc DwgProps) (vl-load-com) (setq App (vlax-Get-Acad-Object) Doc (vla-Get-ActiveDocument App) DwgProps (vla-Get-SummaryInfo Doc) ) (if (getCustomDwgProp key) (vla-SetCustomByKey DwgProps key value) (vla-AddCustomInfo DwgProps key value) ) )
    1 point
  2. Try this. It only inserts a text object at the mid point between vertices. The text is in the current layer and displays the distance between each vertex. When prompted select all the polylines. the variable t_ht controls the height of the text. (defun c:polydist ( / c_doc c_spc t_ht ss ent e_p s_p dist ang t_pt t_obj) (setq c_doc (vla-get-activedocument (vlax-get-acad-object)) c_spc (vlax-get-property c_doc (if (= 1 (getvar 'cvport)) 'paperspace 'modelspace)) t_ht 20 );end_setq (prompt "Select Polylines : ") (setq ss (ssget '((0 . "*POLYLINE")))) (repeat (setq cnt (sslength ss)) (setq ent (ssname ss (setq cnt (1- cnt))) e_p (vlax-curve-getendparam ent) s_p 0.0 ) (while (< s_p e_p) (setq dist (- (vlax-curve-getdistatparam ent (1+ s_p)) (vlax-curve-getdistatparam ent s_p)) ang (angle '(0.0 0.0 0.0) (vlax-curve-getfirstderiv ent (/ (+ s_p s_p 1) 2.0))) t_pt (vlax-curve-getpointatparam ent (/ (+ s_p (1+ s_p)) 2.0)) t_obj (vla-addtext c_spc (rtos dist 2 0) (vlax-3d-point t_pt) t_ht) s_p (1+ s_p) ) (mapcar '(lambda (x y) (vlax-put-property t_obj x y)) (list 'alignment 'textalignmentpoint 'rotation) (list acAlignmentBottomCenter (vlax-3d-point t_pt) ang)) ) ) ) It should do all selected polylines and give you an idea of how it can be automated.
    1 point
  3. 1 point
×
×
  • Create New...