Search the Community
Showing results for tags 'segments'.
Found 2 results
Hello, I'm using a nice LISP which lists the segments length of a polyline you select, but I would just like to add shortest, longest and average below the text "total polyline length is..." like MIN: xx MAX: yy AVG: zz (defun c:Test (/ T_Entity T_Object T_Start T_End T_SegmentLengths T_Count) (if (and (setq T_Entity (car (entsel "\nSelect polyline: "))) (= (vla-get-ObjectName (setq T_Object (vlax-ename->vla-object T_Entity))) "AcDbPolyline") ) (progn (setq T_Start (vlax-curve-getStartParam T_Object)) (setq T_End (vlax-curve-getEndParam T_Object)) (while (< T_Start T_End) (setq T_SegmentLengths (append T_SegmentLengths (list (- (vlax-curve-getDistAtParam T_Object (setq T_Start (1+ T_Start))) (vlax-curve-getDistAtParam T_Object (1- T_Start)))))) ) (setq T_Count 0) (foreach T_Item T_SegmentLengths (princ (strcat "\nSegment " (itoa (setq T_Count (1+ T_Count))) ": " (rtos T_Item (getvar "LUNITS") 6))) ) (princ (strcat "\n\n ** Total polyline length is " (rtos (vla-get-Length T_Object) (getvar "LUNITS") 6))) ) (princ "\n ** Nothing selected or not a polyline.") ) (princ) ) Thx MINMAXLENGHTS.lsp
niculaegeorge posted a topic in Autodesk 3ds MaxGoal: Create a quarter of an ellipse, and elevate one of its points. I’ve manage to make it work, but inside a function, everything falls apart. Obviously from the code that I’m a beginner, so this is it: Delete $* clearlistener () function test var1 = ( Ellipse adaptive: true length:10 width:var1 pos:[0,0,0] name: "s" convertToSplineShape $s updateshape $s Select $s modPanel.setCurrentObject $s.baseObject --this line is optional subobjectLevel = 2 setSegSelection $s 1 (#(1,3,4)) --keep: false –delete all except second quadrant splineOps.delete $ --everything is ok until now --actionMan.executeAction 0 "40020" -- worked for a while, then it started to delete the entire shape subobjectLevel = 0 --this is where everything goes berserk, I tried "=2" as well, still not working. updateshape $s --clearselection() addmodifier $s (Spline_IK_Control helper_size: 0.5 linkTypes: 2 box:off helper_cross: on wirecolor: yellow) updateshape $s $s.spline_ik_control.createHelper ($s.spline_ik_control.getKnotCount()) clearselection() move $Point001 [0,0,10] --point repositioning not working on the second run of the code $Point001.pos.z =10 --not working either when the code is run second time ) test 20 Point repositioning in the last lines at first they did not work, then it started again but point002 start to move as well, then it only worked after the second execution of the code in a fresh environment. I feel like I’m in the Twilight Zone... at line subobjectlevel = 0 after the splineops.delete $ command, the segments reappear as if the delete command did not took hold. Like it was a temporary delete of somekind. I've tried resetshape, updateshape, clearselection, and many things in different arrangements. Is there a command like „clear and empty all variables and reset the entire environment for a fresh start” to place at the start of the code? What am I missing here? My guess is that I'M NOT EXITING FROM THE SUB-OBJECT EDITING MODE PROPERLY and thus the results are not embedded and printed out of from the shape cache or something. And probably that is why the final repositioning of a spline IK point is not working properly, since I’m still in a somekind of a sub-object editing mode.