Message 1 of 2
Help Needed ...

Not applicable
04-11-2006
04:33 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi All,
I am writing a program to assign elevation to the entities by fence selection. I am very near to finish my code but I have a problem which really made me exhaust.
Please take a look for my code below:
***********************************************
(defun c:el()
(setvar "osmode" 0)
(setq pt1 (getpoint "Please pick starting point of fence:"))
(command "pline" pt1 pause "")
(setq FstEnt (entlast)
FstEnt1 (vlax-ename->vla-object FstEnt)
pt2 (vlax-curve-getEndPoint FstEnt1))
(command "select" "f" pt1 pt2 "" "r" fstent "")
(setq sset (ssget "p" ' ((0 . "lwpolyline,polyline")))
n 0
NxtEnt (ssname sset n)
pntlst (car (GetInters FstEnt NxtEnt))
dist1 (distance pt1 pntlst)
list1 (list dist1))
(repeat (- (sslength sset) 1)
(setq n (+ 1 n)
NxtEnt (ssname sset n)
pntlst (car (GetInters FstEnt NxtEnt))
dist1 (distance pt1 pntlst)
list2 (list dist1)
list1 (append list1 list2))
)
(setq list1 (vl-sort list1 '<)
elemcount 0)
(repeat (sslength sset)
(setq listcount 0)
(repeat (sslength sset)
(setq NxtEnt (ssname sset listcount)
pntlst (car (GetInters FstEnt NxtEnt))
dist1 (distance pt1 pntlst)
elem1 (nth elemcount list1))
(if (= elem1 dist1)
(progn
(command "change" NxtEnt "" "p" "c" (+ elemcount 1) "")
);end progn
);end if
(setq listcount (+ 1 listcount))
);repeat
(setq elemcount (+ 1 elemcount))
);repeat
(entdel FstEnt)
)
I have used GETINTERS to get intersection points.
*********************************************************
Now my problem is.... when I am changing the color of entities, its working fine but as I started assigning elevation to them, it shows error. I have tried change command & entmod for elevation assigning.
Please suggest me where I am wrong.
thanks
I am writing a program to assign elevation to the entities by fence selection. I am very near to finish my code but I have a problem which really made me exhaust.
Please take a look for my code below:
***********************************************
(defun c:el()
(setvar "osmode" 0)
(setq pt1 (getpoint "Please pick starting point of fence:"))
(command "pline" pt1 pause "")
(setq FstEnt (entlast)
FstEnt1 (vlax-ename->vla-object FstEnt)
pt2 (vlax-curve-getEndPoint FstEnt1))
(command "select" "f" pt1 pt2 "" "r" fstent "")
(setq sset (ssget "p" ' ((0 . "lwpolyline,polyline")))
n 0
NxtEnt (ssname sset n)
pntlst (car (GetInters FstEnt NxtEnt))
dist1 (distance pt1 pntlst)
list1 (list dist1))
(repeat (- (sslength sset) 1)
(setq n (+ 1 n)
NxtEnt (ssname sset n)
pntlst (car (GetInters FstEnt NxtEnt))
dist1 (distance pt1 pntlst)
list2 (list dist1)
list1 (append list1 list2))
)
(setq list1 (vl-sort list1 '<)
elemcount 0)
(repeat (sslength sset)
(setq listcount 0)
(repeat (sslength sset)
(setq NxtEnt (ssname sset listcount)
pntlst (car (GetInters FstEnt NxtEnt))
dist1 (distance pt1 pntlst)
elem1 (nth elemcount list1))
(if (= elem1 dist1)
(progn
(command "change" NxtEnt "" "p" "c" (+ elemcount 1) "")
);end progn
);end if
(setq listcount (+ 1 listcount))
);repeat
(setq elemcount (+ 1 elemcount))
);repeat
(entdel FstEnt)
)
I have used GETINTERS to get intersection points.
*********************************************************
Now my problem is.... when I am changing the color of entities, its working fine but as I started assigning elevation to them, it shows error. I have tried change command & entmod for elevation assigning.
Please suggest me where I am wrong.
thanks