Author Topic: Please help about objectId tansfer from lisp to .net  (Read 1800 times)

0 Members and 1 Guest are viewing this topic.

Crazybuilder

  • Guest
Please help about objectId tansfer from lisp to .net
« on: April 02, 2012, 11:01:51 AM »
Hello :
        Somebody can help me ? This problem trouble me all day long. I wanna transfer objectID form VLisp to .net. The following is my lisp code
Code: [Select]
   
(defun ZSW::VLA::enameObjID(name / vlaName vlaObjID)
  (setq vlaName (vlax-ename->vla-object name))
  (setq vlaObjID (vlax-get-property vlaName 'ObjectID))
  vlaObjID
)
.....
 (setq xdata (ZSW::VLA::enameObjID lname))
 (WriteDetailInfo xdata "HG/T20615-2009" "法兰" "200-150 RF" "20II" "12.1" "12.1" "1")
.....
"WriteDetailInfo" defined in my .net <lispfunction"WriteDetailInfo"> _
But in fact this doesn't work. What I got in .net  shows that xdata is lispdatatype.Int32 but lispdatatype.ObjectId
the question is how can I get correct objectID from lisp.

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: Please help about objectId tansfer from lisp to .net
« Reply #1 on: April 02, 2012, 11:19:40 AM »
It might be better all around to pass the object handle, and do the handle -> ID tranlsation on the .NET side.
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

Crazybuilder

  • Guest
Re: Please help about objectId tansfer from lisp to .net
« Reply #2 on: April 02, 2012, 11:45:53 AM »
thanks dgorsman
sounds a good idea,I'll try it

gile

  • Gator
  • Posts: 2520
  • Marseille, France
Re: Please help about objectId tansfer from lisp to .net
« Reply #3 on: April 02, 2012, 12:40:40 PM »
Hi,

For LispDataType.ObjectId, use the ename, not the COM (vla) ObjectId.
Speaking English as a French Frog

TheMaster

  • Guest
Re: Please help about objectId tansfer from lisp to .net
« Reply #4 on: April 02, 2012, 03:10:24 PM »
Hello :
        Somebody can help me ? This problem trouble me all day long. I wanna transfer objectID form VLisp to .net. The following is my lisp code
Code: [Select]
   
(defun ZSW::VLA::enameObjID(name / vlaName vlaObjID)
  (setq vlaName (vlax-ename->vla-object name))
  (setq vlaObjID (vlax-get-property vlaName 'ObjectID))
  vlaObjID
)
.....
 (setq xdata (ZSW::VLA::enameObjID lname))
 (WriteDetailInfo xdata "HG/T20615-2009" "法兰" "200-150 RF" "20II" "12.1" "12.1" "1")
.....
"WriteDetailInfo" defined in my .net <lispfunction"WriteDetailInfo"> _
But in fact this doesn't work. What I got in .net  shows that xdata is lispdatatype.Int32 but lispdatatype.ObjectId
the question is how can I get correct objectID from lisp.

No need to pass handle strings here (that's actually far more
difficult to convert to an ObjectId in managed code).

You need to pass the LISP entity name, not the value returned
by the ActiveX/vla-Object's ObjectID property (which is a 32 bit integer).

If you have a vla-object, then you can use (vlax-vla-object->ename)
to get the value you need to pass.