Author Topic: C3D 2012 Point GetUserDefinedPropertyValue  (Read 1863 times)

0 Members and 1 Guest are viewing this topic.

zeppeldep

  • Guest
C3D 2012 Point GetUserDefinedPropertyValue
« on: July 30, 2012, 06:07:51 AM »
INTEROP COM Development.
Using C# 2010 to make apps for C3D 2012.
This is best answered by expert C3D VBA swampers, as I am using the COM.
I have created user defined point classification. Now I want to code the transfer from an existing C3D Point field to the custom field.
The code line issuing the Point method: GetUserDefinedPropertyValue results in 'Unspecified Error'
Any solutions?
Thx.
Kevin.


Jeff_M

  • King Gator
  • Posts: 4092
  • C3D user & customizer
Re: C3D 2012 Point GetUserDefinedPropertyValue
« Reply #1 on: July 30, 2012, 10:36:09 AM »
How about posting the code so it can be checked? And maybe a small dwg to test with?

zeppeldep

  • Guest
Re: C3D 2012 Point GetUserDefinedPropertyValue
« Reply #2 on: July 31, 2012, 12:49:57 AM »
Example attached ... current: cogo points have descriptions (Not the Field, the property - dont ask!).
Need to transfer these values to a custom field - already available in the dwg (custom class, general name)
This code, to read the custom fields works fine:

foreach (IAeccUserDefinedPropertyClassification udpc1 in CDb.PointUserDefinedPropertyClassifications)
{
    foreach (IAeccUserDefinedProperty udp1 in udpc1.UserDefinedProperties)
    {
        if (udp1.PropertyFieldType == AeccUDPPropertyFieldType.aeccUDPPropertyFieldTypeString)
        {
            listBox2.Items.Add(udp1.Name);
        }
    }
}

Error occurs when trying to set the custom field:  (default case):

IAeccPoint pnt1 = CDb.Points.Item(i1);
switch (listBox3.SelectedItems[0].ToString())
{
    case "Description":
        To1 = pnt1.Description;
        break;
    case "Raw Description":
        To1 = pnt1.RawDescription;
        break;
    case "Name":
        To1 = pnt1.Name;
        break;
    default:
        To1 = (string)pnt1.GetUserDefinedPropertyValue(listBox3.SelectedItems[0].ToString());
        break;
}

To1 = (string)pnt1.GetUserDefinedPropertyValue(listBox3.SelectedItems[0].ToString()); causes error - unspecified ...

zeppeldep

  • Guest
Re: C3D 2012 Point GetUserDefinedPropertyValue
« Reply #3 on: July 31, 2012, 12:51:44 AM »
Yes .. I know 1 refers to listbox2 and the other listbox3 ... I have not included all the code ... that is not the problem ..