Which version of AutoCAD do you use ?
AutoCAD 2011
What are your UnitSettings ?
Default settings for units
Here's the code before.
I've found the problem, why become error: bad argument type: numberp: nil?
It occurs because removing the same data in the list does not work well.
;(setq abc (LM:LISTDUPES DistList))
So, I change with Fuzz and works.
(setq abc (LM:UniqueFuzz DistList 0.01))
I don't get errors again.
@kdub
Thanks
.
(repeat (sslength SelPline)
(setq bblistpoint
(mapcar '(lambda (x) x) (bbrotate (ssname SelPline i)))
)
;memastikan nilai selalu lebih kecil dari Y
(setq DistList (vl-sort (GetDistances bblistpoint) '<))
;penyakitnya disini karena menghasilkan nilai nil
;(setq abc (LM:LISTDUPES DistList))
(setq abc (LM:UniqueFuzz DistList 0.01))
(setq Point1 (car abc))
(setq Point2 (cadr abc))
(setq i (1+ i))
(setq NewList (append (list PXY)
(list RRL)
(list group)
(list (list material))
)
)
(setq InsPointList (cons (cons PtMin NewList) InsPointList))
)
(setq InsObjList (reverse InsPointList))
(repeat (length InsObjList)
(setq DataInsert (nth j InsObjList))
(if (minusp (round (- (atof (angtos ANG 0 2)) 90.0) 0.1))
(setq ang2 (+ 360.0 (round (- (atof (angtos ANG 0 2)) 90.0) 0.1)))
(setq ang2 (round (- (atof (angtos ANG 0 2)) 90.0) 0.1))
) ;if
;(setq ang2 (round (- (atof (angtos ANG 0 2)) 90.0) 0.001))
(COMMAND "-iNSERT" "RoofMaterial" (car DataInsert) 1 1 ang2)
)
I will provide a post with value for a change to the next post.
I just post some script when found an error from my whole code.
udaafri, I have no dispute with your post.
A bit of additional info would be helpful.
Which version of AutoCAD do you use ??
What are your UnitSettings ?
You say you have trouble when looping. ... How are you looping. ?
You prompt for :
'Determine the first Direction Point' and
'Determine the second Direction Point'
but have the insertPoint hard-coded in the Command. .. is this your usual practice ?
Regards,