Author Topic: Newly created object to new layer  (Read 1468 times)

0 Members and 1 Guest are viewing this topic.

cadpro

  • Guest
Newly created object to new layer
« on: December 12, 2011, 06:55:47 AM »
Hi,

I create a polyline  as the code below:

Code: [Select]
doc.SendStringToExecute("_PLINE" & vbCr, True, False, True)
As soon as this is created, a form pops up where I want to save the created pline into a new layer. I have code to create the new layer. This is called in the save button of the second form as here:

Code: [Select]
Dim layerId as ObjectId = CreateLayer("testlayer")
Would this be possible?

Thanks

MexicanCustard

  • Swamp Rat
  • Posts: 705
Re: Newly created object to new layer
« Reply #1 on: December 12, 2011, 08:06:24 AM »
Yes, you can create the layer and add it to the object post creation but be careful using the SendStringToExecute.  I was told by ADN members that this doesn't always perform the way you would expect it too.  The string is put in a que to execute but sometimes may not execute during this line of code thus when you go to change the object's layer the object may not exist yet.
Revit 2019, AMEP 2019 64bit Win 10

fixo

  • Guest
Re: Newly created object to new layer
« Reply #2 on: December 12, 2011, 01:57:59 PM »
@cadpro
See this code by Bryco
http://www.theswamp.org/index.php?topic=29216.msg348193#msg348193
this will create polyline as you want just add put the layer you need