Getting vertices of an entity from a linked DWG
Hi,
I'm linking a dwg file into max and the I'm trying to get the the vertices of a line on a certain layer. I know that I have only one line on that layer.
Then I try to create a camera using the retrieved points, but I get only [0,0,0] coordinates.
What am I doing wrong?
The code looks like this:
for i = 0 to layerManager.count-1 do ( ilayer = layerManager.getLayer i layerName = ilayer.name if matchpattern layerName pattern:"CAM-IN*" do ( splitName=filterstring layerName "-" cameraname=splitName[2] ilayer.nodes &theNodes for n in theNodes do ( a=n format "\na = %" a c=edit_poly() addmodifier a c mypoint1 = a.modifiers[#Edit_Poly].Getvertex 1 mypoint2 = a.modifiers[#Edit_Poly].Getvertex 2 format "\n%" layerName format "\n% - %" mypoint1 mypoint2 max create mode newcam = TargetCamera name:cameraname pos:mypoint2 target:(TargetObject name:(cameraname + ".Target") pos:mypoint1) ) ) )
Any advice would be appreciated.
Thank you.